$('ul.children').each(function () {
$(this).before('<a class="toggle" href="#"></a>');
});
- $('a.toggle').click('click', function () {
- $(this).toggleClass('open');
- $(this).siblings('ul').toggleClass('open');
+ // $('a.toggle').click('click', function () {
+ // $(this).toggleClass('open');
+ // $(this).siblings('ul').toggleClass('open');
+ // });
+ $('a.toggle').on("click", function (e) {
+ // $(this).toggleClass('open');
+ // $(this).siblings('ul').toggleClass('open');
+ if( $(this).hasClass("open") ){
+ $(this).removeClass("open")
+ $(this).siblings('ul').removeClass("open");
+ }else{
+
+ $(this).addClass("open")
+ $(this).siblings('ul').addClass("open");
+ }
+
});
+ // if( $(window).width() < 1024){
+ // if(window.glmData.location){
+ // $('a.toggle').trigger("click");
+ // $('.off-canvas-wrap').foundation('offcanvas', 'show', 'move-right');
+ // }
+ // }
+ $('.left-off-canvas-list').find('.menu-item-has-children > a:not(.toggle)').on("click", function(e){
+
+ e.preventDefault();
+ // $(this).children('a.toggle').toggleClass('open');
+ // $(this).children('ul').toggleClass('open');
+ if( $(this).next().hasClass("open") ){
+ $(this).next().removeClass("open")
+ $(this).siblings('ul').removeClass("open");
+ }else{
+
+ $(this).next().addClass("open")
+ $(this).siblings('ul').addClass("open");
+ }
+ })
+
+ $(".menu-item:not(.menu-item-has-children) > a:not(.toggle)").on("click", function(e){
+ e.stopPropagation();
+ })
$('.top-bar-section').find('ul.sub-menu.dropdown').each(function (){
var menuImg = $(this).parent('li').prop('id');
var menuNum = menuImg.match(/\d+/)[0];
$('#glm-member-password-lost-form').show();
});
-
+ $('.search-icon').toggle(function() {
+ $('.header-search').animate({ width:'150px' });
+ $('.header-search-input').css("border", "2px solid " + d_blue)
+ }, function() {
+ $('.header-search').animate({ width:'0' });
+ $('.header-search-input').css("border", "2px solid transparent")
+ });
+
+ $('.header-search-input').on("blur", function(){
+ console.log("blur");
+ if( $('.header-search').length > 0 ){
+ console.log("Still open");
+ } else{
+ console.log("closed");
+ }
+ });
- $('.search-icon').toggle(function() {
- $('.header-search').animate({ width:'150px' });
- $('.header-search-input').css("border", "2px solid " + d_blue)
- }, function() {
- $('.header-search').animate({ width:'0' });
- $('.header-search-input').css("border", "2px solid transparent")
+ var main_nav_top_level = $('.top-bar-section').children('ul').children('li.menu-item-has-children');
+ main_nav_top_level.each(function() {
+ $(this).on("click", function(event){
+ var parentId = $(this).attr("id");
+ var childId = $(event.target).parent().attr("id")
+ if( parentId === childId ){
+ event.stopPropagation();
+ event.preventDefault();
+ }
});
-
- $('.header-search-input').on("blur", function(){
- console.log("blur");
- if( $('.header-search').length > 0 ){
- console.log("Still open");
- } else{
- console.log("closed");
+ });
+
+ var main_nav_top_level_oc = $('.left-off-canvas-list').children('ul').children('li.menu-item-has-children');
+ main_nav_top_level_oc.each(function() {
+ $(this).on("click", function(event){
+ let isParent = $(event.target).parent().hasClass("oc_parent");
+ if( isParent ){
+ event.stopPropagation();
+ event.preventDefault();
}
- })
-
+ });
+ });
});
$('ul.children').each(function () {
$(this).before('<a class="toggle" href="#"></a>');
});
- $('a.toggle').click('click', function () {
- $(this).toggleClass('open');
- $(this).siblings('ul').toggleClass('open');
+ // $('a.toggle').click('click', function () {
+ // $(this).toggleClass('open');
+ // $(this).siblings('ul').toggleClass('open');
+ // });
+ $('a.toggle').on("click", function (e) {
+ // $(this).toggleClass('open');
+ // $(this).siblings('ul').toggleClass('open');
+ if( $(this).hasClass("open") ){
+ $(this).removeClass("open")
+ $(this).siblings('ul').removeClass("open");
+ }else{
+
+ $(this).addClass("open")
+ $(this).siblings('ul').addClass("open");
+ }
+
});
+ // if( $(window).width() < 1024){
+ // if(window.glmData.location){
+ // $('a.toggle').trigger("click");
+ // $('.off-canvas-wrap').foundation('offcanvas', 'show', 'move-right');
+ // }
+ // }
+ $('.left-off-canvas-list').find('.menu-item-has-children > a:not(.toggle)').on("click", function(e){
+
+ e.preventDefault();
+ // $(this).children('a.toggle').toggleClass('open');
+ // $(this).children('ul').toggleClass('open');
+ if( $(this).next().hasClass("open") ){
+ $(this).next().removeClass("open")
+ $(this).siblings('ul').removeClass("open");
+ }else{
+
+ $(this).next().addClass("open")
+ $(this).siblings('ul').addClass("open");
+ }
+ })
+
+ $(".menu-item:not(.menu-item-has-children) > a:not(.toggle)").on("click", function(e){
+ e.stopPropagation();
+ })
$('.top-bar-section').find('ul.sub-menu.dropdown').each(function (){
var menuImg = $(this).parent('li').prop('id');
var menuNum = menuImg.match(/\d+/)[0];
$('#glm-member-password-lost-form').show();
});
-
+ $('.search-icon').toggle(function() {
+ $('.header-search').animate({ width:'150px' });
+ $('.header-search-input').css("border", "2px solid " + d_blue)
+ }, function() {
+ $('.header-search').animate({ width:'0' });
+ $('.header-search-input').css("border", "2px solid transparent")
+ });
+
+ $('.header-search-input').on("blur", function(){
+ console.log("blur");
+ if( $('.header-search').length > 0 ){
+ console.log("Still open");
+ } else{
+ console.log("closed");
+ }
+ });
- $('.search-icon').toggle(function() {
- $('.header-search').animate({ width:'150px' });
- $('.header-search-input').css("border", "2px solid " + d_blue)
- }, function() {
- $('.header-search').animate({ width:'0' });
- $('.header-search-input').css("border", "2px solid transparent")
+ var main_nav_top_level = $('.top-bar-section').children('ul').children('li.menu-item-has-children');
+ main_nav_top_level.each(function() {
+ $(this).on("click", function(event){
+ var parentId = $(this).attr("id");
+ var childId = $(event.target).parent().attr("id")
+ if( parentId === childId ){
+ event.stopPropagation();
+ event.preventDefault();
+ }
});
-
- $('.header-search-input').on("blur", function(){
- console.log("blur");
- if( $('.header-search').length > 0 ){
- console.log("Still open");
- } else{
- console.log("closed");
+ });
+
+ var main_nav_top_level_oc = $('.left-off-canvas-list').children('ul').children('li.menu-item-has-children');
+ main_nav_top_level_oc.each(function() {
+ $(this).on("click", function(event){
+ let isParent = $(event.target).parent().hasClass("oc_parent");
+ if( isParent ){
+ event.stopPropagation();
+ event.preventDefault();
}
- })
-
+ });
+ });
});
function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
$element->has_children = ! empty( $children_elements[ $element->ID ] );
$element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : '';
- $element->classes[] = ( $element->has_children && 1 !== $max_depth ) ? 'page_item_has_children' : '';
+ $element->classes[] = ( $element->has_children && 1 !== $max_depth ) ? 'page_item_has_children oc_parent' : '';
$element->classes[] = 'page_item';
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );