1/** 2 * WP Mega Menu Pro Version 2.1.1 jQuery Plugin 3 */ 4 jQuery(function ($) { 5 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { 6 var is_mobile = true; 7 }else{ 8 var is_mobile = false; 9 } 10 var mobile_toggle_option = wp_megamenu_params.wpmm_mobile_toggle_option; //toggle_standard or toggle_accordion 11 var event_behavior = wp_megamenu_params.wpmm_event_behavior; 12 var ajaxurl = wp_megamenu_params.wpmm_ajaxurl; 13 var ajax_nonce = wp_megamenu_params.wpmm_ajax_nonce; 14 var check_woocommerce_enabled = wp_megamenu_params.check_woocommerce_enabled; 15 var enable_mobile = wp_megamenu_params.enable_mobile; 16 var enable_rtl = wp_megamenu_params.wpmm_enable_rtl; 17 18 $('body').addClass('wpmm_megamenu'); 19 20 if(enable_rtl == 1){ 21 $('body').addClass('wpmm_enable_rtl'); 22 } 23 24 /* 25 * Search box Integration 26 */ 27 var submitIcon = $('.wpmm-search-inline'); 28 var inputBox = $('.wpmm-search-icon .search-field'); 29 var isOpen = false; 30 submitIcon.click(function(e){ 31 e.preventDefault(); 32 if($(this).next().find('.wpmm-search-icon').hasClass('inline-search')){ 33 if(isOpen == false){ 34 $(this).next().find('.inline-search').addClass('searchbox-open').removeClass('searchbox-closed'); 35 inputBox.focus(); 36 isOpen = true; 37 } else { 38 $(this).next().find('.inline-search').removeClass('searchbox-open').addClass('searchbox-closed'); 39 inputBox.focusout(); 40 isOpen = false; 41 } 42 } 43 }); 44 45 46 var isOpen2 = false; 47 /* 48 * Search Box In Popup Integration 49 */ 50 $('.wpmm-search-popup').click(function(e){ 51 e.preventDefault(); 52 if($(this).parent().find('.wpmm-search-icon').hasClass('popup-search-form')){ 53 if(isOpen2 == false){ 54 $(this).parent().find('.popup-search-form').addClass('popup-searchbox-open').removeClass('popup-searchbox-closed'); 55 inputBox.focus(); 56 isOpen2 = true; 57 } else { 58 $(this).parent().find('.popup-search-form').removeClass('popup-searchbox-open').addClass('popup-searchbox-closed'); 59 inputBox.focusout(); 60 isOpen2 = false; 61 } 62 } 63 }); 64 65 /* 66 * Search Box In Popup Close Integration 67 */ 68 $('.closepopup,.wpmm-search-overlay').click(function(e){ 69 $(this).parent().removeClass('popup-searchbox-open').addClass('popup-searchbox-closed'); 70 }); 71 72 73 // $(".wpmm-search-popup").colorbox({inline:true, width:"50%",transition:"fade"}); 74 /* 75 * Add Woocommerce Class 76 */ 77 if(check_woocommerce_enabled == "true"){ 78 $('.wp-megamenu-main-wrapper').each(function(){ 79 $(this).addClass('woocommerce'); 80 }); 81 } 82 83 var submenu_open = event_behavior; // check event behavior as follow link on second click or toggle menu on second click 84 /* searchtype onclick function */ 85 $('.wpmm-onclick .wpmega-searchdown').click(function(e){ 86 e.preventDefault(); 87 if($(this).closest('.wp-megamenu-main-wrapper').hasClass('wpmm-fade')){ 88 //fade 89 if($(this).parent().find('.wpmm-sub-menu-wrap').hasClass('wpmm-open-fade')){ 90 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmm-open-fade'); 91 }else{ 92 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrap').removeClass('wpmm-open-fade'); 93 $(this).parent().find('.wpmm-sub-menu-wrap').addClass('wpmm-open-fade'); 94 } 95 }else{ 96 97 //slide 98 if($(this).parent().find('.wpmm-sub-menu-wrap').hasClass('wpmm-mega-slidedown')){ 99 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown').addClass('wpmm-mega-slideup'); 100 $(this).parent().find('.wpmm-mega-slideup').slideUp('slow'); 101 }else{ 102 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown'); 103 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass("wpmm-mega-slideup").addClass("wpmm-mega-slidedown"); 104 $(this).parent().find('.wpmm-mega-slidedown').slideDown('slow'); 105 106 } 107 } 108 });
109 110 $('.wp-mega-menu-link').click(function(){ 111 var parentclass = $(this).parent().attr('class'); 112 if(parentclass == "wpmmreadmorelink"){ 113 var linkk = $(this).attr('href'); 114 window.open(linkk,"_self"); 115 }else if(parentclass == "wpmm-custom-postimage"){ 116 var linkk = $(this).attr('href'); 117 window.open(linkk,"_self"); 118 } 119 }); 120 121 $( 'body' ).on( "mouseenter",'.wpmm-onhover .wp-mega-menu-link',function() { 122 // "mouse enter" 123 if($(this).parent().find('.wpmm-sub-menu-wrap').length > 0 || $(this).parent().find('.wpmm-sub-menu-wrapper').length > 0){ 124 if($(this).closest('.wp-megamenu-main-wrapper').hasClass('wpmm-slide-right')){ 125 $(this).parent().find('.wpmm-sub-menu-wrap').addClass('wpmmenu-slideRight'); 126 } 127 } 128 }).on( "mouseleave", '.wpmm-onhover .wp-mega-menu-link',function() { 129 // "mouse leave" 130 if($(this).parent().find('.wpmm-sub-menu-wrap').length > 0 || $(this).parent().find('.wpmm-sub-menu-wrapper').length > 0){ 131 if($(this).closest('.wp-megamenu-main-wrapper').hasClass('wpmm-slide-right')){ 132 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmmenu-slideRight'); 133 } 134 } 135 }); 136 137 $('body').on( "click",'.wpmm-onclick .wp-mega-menu-link', function(e) { 138 e.preventDefault(); 139 var link = $(this).attr('href'); 140 var parent_class = $(this).parent().attr('class'); 141 if(!$(this).parent().hasClass('wpmm-tabs-section')){ 142 if($(this).parent().find('.wpmm-sub-menu-wrap').length > 0 || $(this).parent().find('.wpmm-sub-menu-wrapper').length > 0){ 143 if(submenu_open == "follow_link"){ 144 //Open submenu on first click and follow link on second click. 145 if(!$(this).hasClass('clicked')){ 146 if($(this).closest('.wp-megamenu-main-wrapper').hasClass('wpmm-fade')){ 147 //effect as fade 148 if($(this).parent().hasClass('wpmega-menu-megamenu')){ 149 //megamenu 150 if($(this).parent().find('.wpmm-sub-menu-wrap').hasClass('wpmm-open-fade')){ 151 152 $(this).closest('.wpmm-mega-wrapper').find('.wp-mega-menu-link').removeClass('clicked'); 153 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrap').removeClass('wpmm-open-fade'); 154 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrapper').removeClass('wpmm-open-fade'); 155 $(this).closest('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 156 157 }else{ 158 159 $('.wpmm-sub-menu-wrap').removeClass('wpmm-open-fade'); 160 $('.wp-mega-menu-link').removeClass('clicked'); 161 $('.wpmm-sub-menu-wrapper').removeClass('wpmm-open-fade'); 162 $('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 163 164 $(this).parent().find('.wpmm-sub-menu-wrap').addClass('wpmm-open-fade'); 165 $(this).parent().find('.wpmm-sub-menu-wrapper').addClass('wpmm-open-fade'); 166 $(this).parent().find('.wp-mega-menu-link').addClass('clicked'); 167 $(this).parent().addClass('active-show'); 168 169 } 170 171 }else{ 172 //flyout 173 $(this).siblings('.wpmm-sub-menu-wrapper').toggleClass('wpmm-open-fade'); 174 $(this).parent().addClass('active-show'); 175 if(!$(this).siblings('.wpmm-sub-menu-wrapper').hasClass('wpmm-open-fade')){ 176 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrap').removeClass('wpmm-open-fade'); 177 $(this).closest('.wpmm-mega-wrapper').find('.wp-mega-menu-link').not($(this)).removeClass('clicked'); 178 $(this).closest('.wpmm-mega-wrapper').find('.wp-mega-menu-link').removeClass('clicked'); 179 $(this).parent().removeClass('active-show'); 180 } 181 } 182 }else{ 183 184 //slide 185 if($(this).parent().hasClass('wpmega-menu-megamenu')){ 186 if($(this).parent().find('.wpmm-sub-menu-wrap').hasClass('wpmm-mega-slidedown')){ 187 188 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown').addClass('wpmm-mega-slideup'); 189 $(this).parent().removeClass('active-show'); 190 }else{ 191 192 $(this).closest('.wpmm-mega-wrapper').find('.wp-mega-menu-link').removeClass('clicked'); 193 $(this).closest('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 194 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown'); 195 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slidedown'); 196 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass("wpmm-mega-slideup").addClass("wpmm-mega-slidedown"); 197 $(this).parent().addClass('active-show'); 198 } 199 }else{ 200 //flyout 201 if($(this).parent().find('.wpmm-sub-menu-wrapper').hasClass('wpmm-mega-slidedown')){ 202 $(this).siblings('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slidedown'); 203 $(this).closest('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 204 }else{ 205 206 $(this).siblings('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slideup').addClass("wpmm-mega-slidedown"); 207 $(this).parent().addClass('active-show'); 208 209 } 210 } 211 } 212 $(this).addClass('clicked'); 213 }else{ 214 //has been clicked once. 215 if(!link || link == '#') { 216 $(this).removeClass('clicked'); 217 218 if($(this).parent().hasClass('wpmega-menu-megamenu')){ 219 if($('.wp-megamenu-main-wrapper').hasClass('wpmm-fade')){ 220 $( this ).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmm-open-fade'); 221 $(this).parent().removeClass('active-show'); 222 }else{ 223 224 if($(this).parent().find('.wpmm-sub-menu-wrap').hasClass('wpmm-mega-slidedown')){ 225 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown').addClass('wpmm-mega-slideup'); 226 $(this).parent().removeClass('active-show'); 227 }else{ 228 $(this).closest('.wpmm-mega-wrapper').find('.wp-mega-menu-link').removeClass('clicked'); 229 $(this).closest('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 230 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown'); 231 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slidedown'); 232 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass("wpmm-mega-slideup").addClass("wpmm-mega-slidedown"); 233 $(this).parent().addClass('active-show'); 234 } 235 236 // $(this).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown').addClass('wpmm-mega-slideup'); 237 // $(this).parent().addClass('active-show'); 238 // $(this).closest('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 239 } 240 }else{ 241 //flyout 242 if($('.wp-megamenu-main-wrapper').hasClass('wpmm-fade')){ 243 //fade open 244 $(this).siblings('.wpmm-sub-menu-wrapper').removeClass('wpmm-open-fade'); 245 $(this).parent().removeClass('active-show'); 246 }else{ 247 //slide 248 if($(this).parent().find('.wpmm-sub-menu-wrapper').hasClass('wpmm-mega-slidedown')){ 249 $(this).siblings('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slidedown'); 250 $(this).closest('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 251 }else{ 252 253 $(this).siblings('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slideup').addClass("wpmm-mega-slidedown"); 254 $(this).parent().addClass('active-show'); 255 256 } 257 258 // $(this).siblings('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slidedown'); 259 // $(this).parent().addClass('active-show'); 260 } 261 262 } 263 return false; 264 }else{ 265 266 if($(this).hasClass('clicked')){ 267 var target = $(this).attr('target'); 268 // alert(target); 269 if(target == "_blank"){ 270 window.open(link,target); 271 }else{ 272 window.location= link; 273 } 274 275 }else{ 276 $(this).closest('.wpmm-mega-wrapper').find('.wp-mega-menu-link').removeClass('clicked'); 277 $(this).addClass('clicked'); 278 } 279 280 } 281 } 282 }else{ 283 //submenu_click 284 //Open Submenu on first click and close on second click. 285 $(this).removeClass('clicked'); 286 287 if($(this).closest('.wp-megamenu-main-wrapper').hasClass('wpmm-fade')){ 288 //fade effect 289 if($(this).parent().hasClass('wpmega-menu-megamenu')){ 290 // alert('megamenu'); 291 //megamennu 292 if($(this).parent().find('.wpmm-sub-menu-wrap').hasClass('wpmm-open-fade')){ 293 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmm-open-fade'); 294 $(this).parent().removeClass('active-show'); 295 }else{ 296 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrap').removeClass('wpmm-open-fade'); 297 $(this).closest('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 298 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrapper').removeClass('wpmm-open-fade'); 299 $(this).parent().find('.wpmm-sub-menu-wrap').addClass('wpmm-open-fade'); 300 $(this).parent().addClass('active-show'); 301 } 302 }else{ 303 //flyout 304 305 if($(this).siblings('.wpmm-sub-menu-wrapper').hasClass('wpmm-open-fade')){ 306 $(this).siblings('.wpmm-sub-menu-wrapper').removeClass('wpmm-open-fade'); 307 $(this).parent().removeClass('active-show'); 308 }else{ 309 $(this).siblings('.wpmm-sub-menu-wrapper').addClass('wpmm-open-fade'); 310 $(this).parent().addClass('active-show'); 311 } 312 313 } 314 315 316 }else{ 317 // alert('yes_slide'); 318 //slide effect 319 if($(this).parent().hasClass('wpmega-menu-megamenu')){ 320 if($(this).parent().find('.wpmm-sub-menu-wrap').hasClass('wpmm-mega-slidedown')){ 321 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown'); 322 $(this).parent().removeClass('active-show'); 323 }else{ 324 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrap').removeClass('wpmm-mega-slidedown'); 325 $(this).closest('.wpmm-mega-wrapper').find('li').removeClass('active-show'); 326 $(this).closest('.wpmm-mega-wrapper').find('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slidedown'); 327 $(this).parent().find('.wpmm-sub-menu-wrap').removeClass("wpmm-mega-slideup").addClass("wpmm-mega-slidedown"); 328 $(this).parent().addClass('active-show'); 329 } 330 }else{ 331 //flyout 332 if($(this).siblings('.wpmm-sub-menu-wrapper').hasClass('wpmm-mega-slidedown')){ 333 $(this).siblings('.wpmm-sub-menu-wrapper').removeClass('wpmm-mega-slidedown'); 334 $(this).parent().removeClass('active-show'); 335 }else{ 336 $(this).siblings('.wpmm-sub-menu-wrapper').removeClass("wpmm-mega-slideup").addClass("wpmm-mega-slidedown"); 337 $(this).parent().addClass('active-show'); 338 } 339 340 341 } 342 } 343 } 344 }else{ 345 var target = $(this).attr('target'); 346 if(target== ""){ 347 target = "_self"; 348 } 349 // alert(target); 350 if(target == "_blank"){ 351 window.open(link,target); 352
352 }else{ 353 window.location= link; 354 } 355 } 356 e.stopImmediatePropagation(); 357 // e.stopPropagation(); 358 return false; 359 } 360 }); 361 $(document).on('click', function (e) { 362 if ($(e.target).closest(".wp-megamenu-main-wrapper").length === 0) { 363 $(".wp-megamenu-main-wrapper .wpmm-sub-menu-wrap").removeClass('wpmm-open-fade'); 364 $(".wp-megamenu-main-wrapper li").removeClass('active-show'); 365 $(".wp-megamenu-main-wrapper .wpmm-search-form .wpmm-search-icon").addClass('searchbox-closed'); 366 $(".wp-megamenu-main-wrapper .wpmm-sub-menu-wrapper").removeClass('wpmm-open-fade'); 367 $(".wp-megamenu-main-wrapper .wp-mega-menu-link").removeClass('clicked'); 368 } 369 }); 370 371 372 /* Responsive Settings Toggle Bar*/ 373/* $('.wpmega-closeblock').click(function() { 374 $(this).parent().parent().parent().find('.wpmm-mega-wrapper').slideToggle(1000,function(){ 375 $(this).parent().parent().parent().find('.wpmm-mega-wrapper').addClass('hide-menu'); 376 }); 377 $(this).parent().parent().parent().find('.wpmega-openblock').show(); 378 $(this).hide(); 379 $(this).closest('.wp-megamenu-main-wrapper').find('.wpmega-responsive-closebtn').hide(); 380 }); 381 382 $('.wpmega-openblock').click(function() { 383 $(this).parent().parent().parent().find('.wpmm-mega-wrapper').slideToggle(1000,function(){ 384 $(this).parent().parent().parent().find('.wpmm-mega-wrapper').removeClass('hide-menu'); 385 }); 386 $(this).parent().parent().parent().find('.wpmega-closeblock').show(); 387 $(this).closest('.wp-megamenu-main-wrapper').find('.wpmega-responsive-closebtn').show(); 388 $(this).hide(); 389 }); 390*/ 391 392/* 393* Mobile - Set to clickable menu always 394*/ 395if(enable_mobile == 1){ 396 var winwidth = ''; 397 $(window).on("resize", function(event){ 398 winwidth = $(this).width(); 399 $('.wp-megamenu-main-wrapper').each(function(){ 400 var trigger_effect = $(this).find('.wpmm-mega-wrapper').attr('data-trigger-effect');//wpmm-onhover 401 var responsive_breakingpoint = $(this).find('.wpmegamenu-toggle').attr('data-responsive-breakpoint'); 402 responsive_breakingpoint = responsive_breakingpoint.replace('px', ''); 403 if(responsive_breakingpoint == ''){ 404 responsive_breakingpoint = "910"; 405 } 406 if(winwidth <= responsive_breakingpoint){ 407 if($(this).hasClass('wpmm-onhover')){ 408 $(this).removeClass('wpmm-onhover'); 409 $(this).addClass('wpmm-onclick'); 410 } 411 $('.wpmega-tabs').each(function(){ 412 if($(this).hasClass('wpmm-tabbed-onhover')){ 413 $(this).removeClass('wpmm-tabbed-onhover'); 414 $(this).addClass('wpmm-tabbed-onclick'); 415 } 416 }); 417 }else{ 418 if(trigger_effect == 'wpmm-onhover'){ 419 $(this).removeClass('wpmm-onclick'); 420 $(this).addClass('wpmm-onhover'); 421 } 422 } 423 424 }); 425 426 }).resize(); 427 428 $('.wp-megamenu-main-wrapper').on('click','.wpmega-openblock',function(){ 429 var $selector = $(this); 430 $selector.closest('.wp-megamenu-main-wrapper').find('.wpmm-mega-wrapper').toggleClass('wpmm-show-menu'); 431 // $selector.closest('.wp-megamenu-main-wrapper').find('.wpmm-mega-wrapper').slideDown('slow'); 432 $selector.hide(); 433 $selector.closest('.wp-megamenu-main-wrapper').find('.wpmegamenu-toggle .wpmega-closeblock').show(); 434 }); 435 436 $('.wp-megamenu-main-wrapper').on('click','.wpmega-closeblock',function(){ 437 var $selector1 = $(this); 438 $selector1.closest('.wp-megamenu-main-wrapper').find('.wpmm-mega-wrapper').toggleClass('wpmm-show-menu'); 439 //$selector1.closest('.wp-megamenu-main-wrapper').find('.wpmm-mega-wrapper').slideUp('slow'); 440 $selector1.hide(); 441 $selector1.closest('.wp-megamenu-main-wrapper').find('.wpmegamenu-toggle .wpmega-openblock').show(); 442 }); 443 444} 445 446 447 448 449 450 451var win_width = $(window).width(); 452if(!is_mobile){ 453 if( win_width > 980){ 454 $('.wpmm-orientation-vertical > .wpmm-mega-wrapper > li > .wpmm-sub-menu-wrap > .wpmm-sub-menu-wrapper').each(function(){ 455 var height1 = $(this).outerHeight(); 456 var height5 = $(this).prev().outerHeight(); 457 var height4 = $(this).next().outerHeight(); 458 var height2 = $(this).prev().prev().outerHeight(); 459 var height3 = $(this).next().next().outerHeight(); 460 var height = parseInt(height1) + parseInt(height2) + parseInt(height3) + parseInt(height5) + parseInt(height4); 461 $(this).parent('.wpmm-sub-menu-wrap').height(height); 462 });
463 } 464 465 $( window ).resize(function() { 466 $('.wpmm-orientation-vertical').each(function(){ 467 468 if(win_width < 1200){ 469 var menu_width = $(this).width(); 470 //var total_width = parseInt(win_width) - parseInt(menu_width)- 70; 471 var total_width = parseInt(win_width) - parseInt(menu_width); 472 $(this).find('.wpmm-sub-menu-wrap').width(total_width); 473 474 } 475 476 }); 477 478 }).resize(); 479} 480 481 482 /* if(!is_mobile){ 483 484 $('.wpmm-orientation-vertical > .wpmm-mega-wrapper > li > .wpmm-sub-menu-wrap > .wpmm-sub-menu-wrapper').each(function(){ 485 var height1 = $(this).outerHeight(); 486 var height2 = $(this).prev().prev().outerHeight(); 487 var height3 = $(this).next().next().outerHeight(); 488 var height = parseInt(height1) + parseInt(height2) + parseInt(height3); 489 // var height = parseInt(Total) + parseInt(height1); 490 $(this).parent('.wpmm-sub-menu-wrap').height(height); 491 492 493 }); 494 495 /* $('.wpmm-orientation-vertical > .wpmm-mega-wrapper > li > .wpmm-sub-menu-wrap > .wpmm-sub-menu-wrapper').each(function(){ 496 var height1 = $(this).outerHeight(); 497 498 499 // var height2 = $(this).prev().prev().outerHeight(); 500 // var height3 = $(this).next().next().outerHeight(); 501 // var height = parseInt(height1) + parseInt(height2) + parseInt(height3); 502 503 var h1 = $(this).prev().outerHeight(); 504 var h2 = $(this).prev().prev().outerHeight(); 505 var h3 = $(this).next().outerHeight(); 506 var h4 = $(this).next().next().outerHeight(); 507 // if(h1 != "undefined" && h2 != "undefined"){ 508 var t1 = parseInt(h1) + parseInt(h2); 509 // }else if(h1 != "undefined" && h2 == "undefined"){ 510 // var t1 = parseInt(h1); 511 // }else if(h1 == "undefined" && h2 != "undefined"){ 512 // var t1 = parseInt(h2); 513 // }else{ 514 // var t1 = 0; 515 // } 516 517 //if(h3 != "undefined" && h4 != "undefined"){ 518 var t2 = parseInt(h3) + parseInt(h4); 519 // }else if(h3 != "undefined" && h4 == "undefined"){ 520 //var t2 = parseInt(h3); 521 //}else if(h3 == "undefined" && h4 != "undefined"){ 522 // var t2 = parseInt(h4); 523 // }else{ 524 // var t2 = 0; 525 // } 526 527 528 var Total = parseInt(t1) + parseInt(t2); 529 var height = parseInt(Total) + parseInt(height1); 530 531 $(this).parent('.wpmm-sub-menu-wrap').height(height); 532 533 534 }); 535 536 $( window ).resize(function() { 537 $('.wpmm-orientation-vertical').each(function(){ 538 var win_width = $(window).width(); 539 if(win_width < 1200){ 540 var menu_width = $(this).width(); 541 var total_width = parseInt(win_width) - parseInt(menu_width)- 70; 542 543 $(this).find('.wpmm-sub-menu-wrap').width(total_width); 544 545 } 546 547 }); 548 549 }).resize(); 550 } 551 552 */ 553 /* Tabs Javascript */ 554 555 $('.wpmega-tabs').find('.wp-mega-sub-menu li').addClass('wpmm-tabs-section'); 556 // Example Hints: http://jsfiddle.net/uyvUZ/2/ 557 $('.wpmega-tabs > .wpmm-sub-menu-wrapper ul.wp-mega-sub-menu').each(function(i) { 558 $(this).addClass('wpmm-tab-groups'); 559 }); 560 $('.wpmega-tabs > .wpmm-sub-menu-wrapper ul.wp-mega-sub-menu > li .wp-mega-sub-menu').each(function(i) { 561 $(this).addClass('wpmm-tab-groups-panel'); 562 $(this).removeClass('wpmm-tab-groups'); 563 }); 564 $(".wpmm-tabs-section").removeClass('show_tab'); 565 $(".wpmega-tabs .wpmm-sub-menu-wrapper ul.wp-mega-sub-menu.wpmm-tab-groups").each(function() { 566 $(this).find('li:first').addClass("show_tab"); 567 $(this).nextAll('.wp-mega-sub-menu:first').find('.wpmm-tabs-section:first').addClass('show_tab'); 568 }); 569 570 571// $(".wpmega-tabs.wpmm-tabbed-onhover .wpmm-sub-menu-wrapper ul.wp-mega-sub-menu.wpmm-tab-groups > li > a").on('hover',function() { 572// var cTab = $(this).closest('li'); 573// var animated = cTab.closest('.wpmega-tabs').attr('data-animation'); 574// var vcontent_height = $(this).parent().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ); 575// var totaltabheight = $(this).parents('.wpmm-tab-groups').actual('outerHeight'); 576// var hTabTitleHeight = parseInt($(this).parent().height()) + 15; 577// var target = $(this).attr('target'); 578// var link = $(this).attr('href'); 579// 580// if(totaltabheight > 0){ 581// /* Open hide tab content start */ 582// cTab.siblings('li').removeClass('show_tab'); 583// $('.wpmm-tab-groups-panel').removeClass(animated); 584// cTab.addClass('show_tab'); 585// cTab.find('.wpmm-tab-groups-panel').addClass('animated '+animated); 586// cTab.closest('ul.wp-mega-sub-menu').nextAll('.wp-mega-sub-menu:first').find('.wpmm-tabs-section').removeClass('show_tab'); 587// /* Open hide tab content end */ 588// if($(this).closest('.wpmega-tabs').hasClass('wpmega-vertical-tabs')){ 589// if(totaltabheight > vcontent_height){ 590// $(this).parents('.wpmm-tab-groups').css('min-height',totaltabheight); 591// }else{ 592// $(this).parents('.wpmm-tab-groups').css('min-height',vcontent_height); 593// } 594// }else{ 595// var hcontent_height = $(this).parent().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ) + 10; 596// var total_height = parseInt(hcontent_height) + parseInt(hTabTitleHeight); 597// $(this).parents('.wpmm-tab-groups').css('min-height',total_height); 598// } 599// } 600// 601// return false; 602// });
603$(".wpmega-tabs.wpmm-tabbed-onhover .wpmm-sub-menu-wrapper").on({ 604 mouseenter: function () { 605 var cTab = $(this).closest('li'); 606 var animated = cTab.closest('.wpmega-tabs').attr('data-animation'); 607 var vcontent_height = $(this).parent().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ); 608 var totaltabheight = $(this).parents('.wpmm-tab-groups').actual('outerHeight'); 609 var hTabTitleHeight = parseInt($(this).parent().height()) + 15; 610 var target = $(this).attr('target'); 611 var link = $(this).attr('href'); 612 613 if(totaltabheight > 0){ 614 /* Open hide tab content start */ 615 cTab.siblings('li').removeClass('show_tab'); 616 $('.wpmm-tab-groups-panel').removeClass(animated); 617 cTab.addClass('show_tab'); 618 cTab.find('.wpmm-tab-groups-panel').addClass('animated '+animated); 619 cTab.closest('ul.wp-mega-sub-menu').nextAll('.wp-mega-sub-menu:first').find('.wpmm-tabs-section').removeClass('show_tab'); 620 /* Open hide tab content end */ 621 if($(this).closest('.wpmega-tabs').hasClass('wpmega-vertical-tabs')){ 622 if(totaltabheight > vcontent_height){ 623 $(this).parents('.wpmm-tab-groups').css('min-height',totaltabheight); 624 }else{ 625 $(this).parents('.wpmm-tab-groups').css('min-height',vcontent_height); 626 } 627 }else{ 628 var hcontent_height = $(this).parent().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ) + 10; 629 var total_height = parseInt(hcontent_height) + parseInt(hTabTitleHeight); 630 $(this).parents('.wpmm-tab-groups').css('min-height',total_height); 631 } 632 } 633 634 return false; 635 }, 636 mouseleave:function () { 637// $(this).removeClass("hover"); 638 } 639},'ul.wp-mega-sub-menu.wpmm-tab-groups > li > a'); 640 $( window ).resize(function() { 641 if($(window).width() <= 910){ 642 $('.wpmega-tabs.wpmm-tabbed-onclick .wpmm-sub-menu-wrapper ul.wp-mega-sub-menu.wpmm-tab-groups > li > a').on('click',function(e) { 643 e.preventDefault(); 644 var cTab = $(this).closest('li'); 645 var animated = cTab.closest('.wpmega-tabs').attr('data-animation'); 646 var vcontent_height = $(this).parent().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ); 647 var totaltabheight = $(this).parents('.wpmm-tab-groups').actual('outerHeight'); 648 var hTabTitleHeight = parseInt($(this).parent().height()) + 15; 649 var target = $(this).attr('target'); 650 var link = $(this).attr('href'); 651 if(link == '' || link == '#'){ 652 if(totaltabheight > 0){ 653 /* Open hide tab content start */ 654 /* if(cTab.hasClass('show_tab')){ 655 cTab.removeClass('show_tab'); 656 }else{ 657 cTab.siblings('li').removeClass('show_tab'); 658 cTab.closest('ul.wp-mega-sub-menu').nextAll('.wp-mega-sub-menu:first').find('.wpmm-tabs-section').removeClass('show_tab'); 659 cTab.addClass('show_tab'); 660 }*/ 661 //cTab.siblings('li').removeClass('show_tab'); 662 // cTab.closest('ul.wp-mega-sub-menu').nextAll('.wp-mega-sub-menu:first').find('.wpmm-tabs-section').removeClass('show_tab'); 663 cTab.closest('ul.wpmm-tab-groups').find('li').removeClass('show_tab'); 664 cTab.addClass('show_tab'); 665 666 /* Open hide tab content end */ 667 $('.wpmm-tab-groups-panel').removeClass(animated); 668 cTab.find('.wpmm-tab-groups-panel').addClass('animated '+animated); 669 if($(this).closest('.wpmega-tabs').hasClass('wpmega-vertical-tabs')){ 670 if(totaltabheight > vcontent_height){ 671 $(this).parents('.wpmm-tab-groups').css('min-height',totaltabheight); 672 }else{ 673 $(this).parents('.wpmm-tab-groups').css('min-height',vcontent_height); 674 } 675 }else{ 676 var hcontent_height = $(this).parent().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ) + 10; 677 var total_height = parseInt(hcontent_height) + parseInt(hTabTitleHeight); 678 if(cTab.hasClass('show_tab')){ 679 $(this).parents('.wpmm-tab-groups').css('min-height',total_height); 680 }else{ 681 $(this).parents('.wpmm-tab-groups').css('min-height',0); 682 } 683 684 } 685 686 } 687 }else{ 688 if(target == "_blank"){ 689 window.open(link,target); 690 }else{ 691 window.location = link; 692 } 693 } 694 }); 695 }else{ 696 $('.wpmega-tabs.wpmm-tabbed-onclick .wpmm-sub-menu-wrapper').on('click','ul.wp-mega-sub-menu.wpmm-tab-groups > li > a',function(e) { 697 e.preventDefault(); 698 var cTab = $(this).closest('li'); 699 var animated = cTab.closest('.wpmega-tabs').attr('data-animation'); 700 var vcontent_height = $(this).parent().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ); 701 var totaltabheight = $(this).parents('.wpmm-tab-groups').actual('outerHeight'); 702 var hTabTitleHeight = parseInt($(this).parent().height()) + 15; 703 var target = $(this).attr('target'); 704 var link = $(this).attr('href'); 705 706 if(link == '' || link == '#'){ 707 if(totaltabheight > 0){ 708 /* Open hide tab content start */ 709 cTab.siblings('li').removeClass('show_tab'); 710 $('.wpmm-tab-groups-panel').removeClass(animated); 711 // cTab.addClass('show_tab'); 712 cTab.toggleClass('show_tab'); 713 cTab.find('.wpmm-tab-groups-panel').addClass('animated '+animated); 714 cTab.closest('ul.wp-mega-sub-menu').nextAll('.wp-mega-sub-menu:first').find('.wpmm-tabs-section').removeClass('show_tab'); 715 /* Open hide tab content end */ 716 if($(this).closest('.wpmega-tabs').hasClass('wpmega-vertical-tabs')){ 717 if(totaltabheight > vcontent_height){ 718 $(this).parents('.wpmm-tab-groups').css('min-height',totaltabheight); 719 }else{ 720 $(this).parents('.wpmm-tab-groups').css('min-height',vcontent_height); 721 } 722 }else{ 723 var hcontent_height = $(this).parent().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ) + 10; 724 var total_height = parseInt(hcontent_height) + parseInt(hTabTitleHeight); 725 $(this).parents('.wpmm-tab-groups').css('min-height',total_height); 726 } 727 } 728 }else{ 729 if(target == "_blank"){ 730 window.open(link,target); 731 }else{ 732 window.location = link; 733 } 734 } 735 }); 736 737 } 738 }).resize(); 739 740 741 742 743 setTimeout(function(){ 744 $('.wpmega-tabs > .wpmm-sub-menu-wrapper ul.wpmm-tab-groups').each(function(){ 745 var height = $(this).actual( 'outerHeight' ); 746 var content_height = $(this).children('li').first().find('.wpmm-tab-groups-panel').actual( 'outerHeight' ); 747 var horizontalTabTitleHeight = parseInt($(this).children('li').first().actual( 'outerHeight' )) + 15; 748 if($(this).closest('.wpmega-tabs').hasClass('wpmega-vertical-tabs')){ 749 if(height > content_height){ 750 $(this).css('min-height',height); 751 }else{ 752 $(this).css('min-height',content_height); 753 } 754 }else{ 755 var total_height = parseInt(content_height) + parseInt(horizontalTabTitleHeight); 756 $(this).css('min-height',total_height); 757 } 758 }); 759 },2000); 760 /* tabs end */ 761 762 //sticky menu 763 var sticky_opacity = wp_megamenu_params.wpmm_sticky_opacity; 764 var sticky_offset = wp_megamenu_params.wpmm_sticky_offset; 765 766 if(sticky_offset == ''){ 767 sticky_offset = '0px'; 768 }else{ 769 sticky_offset = parseInt(sticky_offset) + 'px'; 770 } 771 772 var sticky_zindex = wp_megamenu_params.wpmm_sticky_zindex; 773 774 if($('.wp-megamenu-main-wrapper').hasClass( "wpmm-pro-sticky" )){ 775 776 $this = $('.wpmm-pro-sticky'); 777 // Check the initial Poistion of the Sticky Header 778 var stickyHeaderTop = $('.wpmm-pro-sticky').offset().top; 779 $(window).scroll(function(){ 780 if( $(window).scrollTop() > stickyHeaderTop ) { 781 782 $this.addClass('navbar-fixed-top'); 783 $('.navbar-fixed-top').css({'top': sticky_offset, 'z-index' : sticky_zindex}); 784 $('.navbar-fixed-top').css('opacity', sticky_opacity); 785 } else { 786 $this.removeClass('navbar-fixed-top'); 787 } 788 }); 789 } 790 // sticky menu end 791 792/* $('.wp-megamenu-main-wrapper .wpmm-sub-menu-wrap').each(function(){ 793 var nextimage = $(this).attr('data-nextimage'); 794 var nextimage1 = $(this).attr('data-nextimage1'); 795 var repeat = $(this).attr('data-repeat'); 796 var position = $(this).attr('data-position'); 797 if(nextimage != '' && nextimage != undefined){ 798 799 $(this).hover(function(){ 800 $(this).addClass("wpmm-fadeOut"); 801 $(this).css("background-image", "url("+nextimage+")"); 802 $(this).css("background-repeat",repeat); 803 $(this).css("background-position",position); 804 $(this).css("background-size",'cover'); 805 //$(this).css("transition",'2.5s'); 806 807 }).mouseleave(function(){ 808 $(this).removeClass("wpmm-fadeOut"); 809 $(this).css("background-image", "url("+nextimage1+")"); 810 $(this).css("background-repeat",repeat); 811 $(this).css("background-position",position); 812 $(this).css("background-size",'cover'); 813 //$(this).css("transition",'0s'); 814 }); 815 816 } 817 818});*/ 819 820 821 $('.wpmm-original-submenus').each(function(){ 822 var id = $(this).find('li').attr('id'); 823 var appended_html = $(this).html(); 824 $(this).parent().find('.wpmm-group1').find('.wpmm-clone-submenus').find('li#'+id).parent().replaceWith(appended_html); 825 $(this).remove(); 826 }); 827 828 829 /* widget posts slider*/ 830 $('.wpmega-posts-slider').each(function(){ 831 var selector = $(this); 832 var speed = $(this).data('speed'); 833 var auto = $(this).data('auto-slide'); 834 var slider_duration = $(this).data('duration'); 835 var controls = $(this).data('controls'); 836 var id = $(this).data('id'); 837 var mode = $(this).data('mode'); 838 $(this).bxSlider({ 839 speed: speed, 840 pause: slider_duration, 841 auto: auto, 842 pager: false, 843 mode: mode, 844 controls: controls, 845 infiniteLoop: false, 846 adaptiveHeight:true 847 });
848 849 }); 850 851 /* 852 * Double animation background image 853 */ 854 $('.wpmm-sub-menu-wrap').each(function(){ 855 if($(this).hasClass('wpmm-double-image-animation')){ 856 var topimage = $(this).find('.animation-double-bgimage').data('top-image'); 857 var bottomimage = $(this).find('.animation-double-bgimage').data('second-image'); 858 $(this).hover(function(){ 859 $(this).css("background-image","url("+bottomimage+")"); 860 }).mouseleave(function(){ 861 $(this).css("background-image", "url("+topimage+")"); 862 }); 863 } 864 }); 865 866 /* 867 * Fusion Avada Theme with its Search icon inside menu compatibiltiy 868 */ 869 $('.wp-megamenu-main-wrapper').each(function(){ 870 var liclass = $(this).find('li.fusion-custom-menu-item'); 871 if(liclass.hasClass('fusion-main-menu-search')){ 872 //has search icon 873 $(this).find('li.fusion-custom-menu-item.fusion-main-menu-search .fusion-custom-menu-item-contents').addClass('wpmm-sub-menu-wrap'); 874 } 875 }); 876 877 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.