1( function( $ ) { 2 3 "use strict"; 4 5 var $scroll_flag = false; 6 7 var isMobile = false; 8 var isiPhoneiPad = false; 9 10 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 11 isMobile = true; 12 } 13 14 if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { 15 isiPhoneiPad = true; 16 } 17 18 // Window ready event start code 19 $( document ).ready( function () { 20 21 $scroll_flag = true; 22 23 setTimeout( function() { 24 25 hongoAddonsInitScrollNavigate(); 26 }, 250 ); 27 28 // photoswipe product gallery conflict with iPad safari 29 if( isiPhoneiPad ) { 30 31 $( document ).on( 'click', '.woocommerce-product-gallery__trigger, .woocommerce-product-gallery__image a', function( e ) { 32 e.preventDefault(); 33 34 $( '.mega-menu-main-wrapper, .shop-mega-menu-wrapper, .simple-menu' ).addClass( 'display-none' ); 35 }); 36 37 $( document ).on( 'click touchstart', '.pswp__button--close', function( e ) { 38 e.preventDefault(); 39 40 $( '.mega-menu-main-wrapper, .shop-mega-menu-wrapper, .simple-menu' ).removeClass( 'display-none' ); 41 }); 42 } 43 44 // Header height adjustment 45 hongoAddonsReadyResize(); 46 47 /* Full width on header sticky */ 48 if( $( '.full-with-on-sticky' ).length > 0 ) { 49 50 $( 'header' ).addClass( 'full-with-header-sticky' ); 51 } 52 53 if( $( '.product-search-wrap select' ).length > 0 ) { 54 55 $( '.product-search-wrap select' ).select2({ 56 minimumResultsForSearch: -1, 57 dropdownCssClass: "search-category-dropdown" 58 }); 59 $( '.product-search-wrap' ).on( 'select2:open', function () { 60 61 $( '.select2-results__options' ).mCustomScrollbar( 'destroy' ); 62 setTimeout( function() { 63 $( '.select2-results__options' ).mCustomScrollbar({ 64 axis: 'y', 65 scrollInertia: 100, 66 scrollButtons:{ 67 enable:false 68 }, 69 keyboard:{ 70 enable: true 71 }, 72 mouseWheel:{ 73 enable:true, 74 scrollAmount:200 75 }, 76 advanced:{ 77 updateOnContentResize:true, /*auto-update scrollbars on content resize (for dynamic content): boolean*/ 78 autoExpandHorizontalScroll:true, /*auto-expand width for horizontal scrolling: boolean*/ 79 } 80 }); 81 }, 5 ); 82 }); 83 } 84 85 // With categories menu minimum height 86 if( $( '.hongo-shop-dropdown-menu' ).length > 0 ) { 87 88 var dropdown_menu_height = $( '.hongo-shop-dropdown-menu ul.navbar-nav' ).outerHeight() + 1; 89 $( '.hongo-shop-dropdown-menu .shop-mega-menu-wrapper' ).css( 'min-height', dropdown_menu_height + 'px' ); 90 91 $( '.hongo-shop-dropdown-menu' ) 92 .mouseenter( function( e ) { 93 94 e.preventDefault(); 95 96 $( this ).addClass( 'active' ); 97 }) 98 .mouseleave( function( e ) { 99 100 e.preventDefault(); 101 102 $( this ).removeClass( 'active' ); 103 }); 104 $( '.hongo-shop-dropdown-menu .shop-dropdown-toggle' ).on( 'touchstart', function() { 105 106 if( $( this ).parent().hasClass( 'active' ) ) { 107 108 $( this ).parent().removeClass( 'active' ); 109 $( '.hongo-shop-dropdown-menu .menu li' ).removeClass( 'on' ); 110 111 } else { 112 113 $( this ).parent().addClass( 'active' ); 114 } 115 }); 116 } 117 118 /* Left menu sticky and accordion */ 119 if( $( '.hongo-left-menu-wrap' ).length > 0 ) { 120 121 $( '.hongo-left-menu-wrap .hongo-left-menu-wrapper' ).on( 'show.bs.collapse', function() { 122 123 $('header').addClass('left-mobile-menu-open'); 124 125 }).on( 'hide.bs.collapse', function() { 126 127 $('header').removeClass('left-mobile-menu-open'); 128 }); 129 130 if( $.inArray( 'sticky-kit', hongoMain.disable_scripts ) < 0 ) { 131 $( '.hongo-main-wrap .header-left-wrapper' ).stick_in_parent({ 132 recalc : 1 133 }); 134 } 135 136 /* Left Menu Accordion */ 137 $( document ).on( 'click', '.hongo-left-menu-wrap li .handler', function() { 138 139 setTimeout( function () { 140 $( '.hongo-main-wrap' ).trigger( 'sticky_kit:recalc' ); 141 }, 500); 142 $(this).parent('li').toggleClass( function() { 143 $( this ).siblings().removeClass( 'on' ); 144 $( this ).siblings().find('.dropdown-menu li').removeClass( 'on' ); 145 $( this ).siblings().find('.dropdown-menu').slideUp(); 146 $( this ).children('.dropdown-menu').slideToggle(); 147 return "on"; 148 }); 149 }); 150 151 $( document ).on( 'hide.bs.collapse', function() { 152 $( 'body' ).removeClass( 'hongo-body-overlay' ); 153 $( '.widget_shopping_cart' ).removeClass( 'open' ); 154 $( '.hongo-top-account-menu' ).removeClass( 'open' ); 155 }); 156 $( document ).on( 'touchstart click', '.hongo-overlay, header .header-logo-wrapper', function() { 157 $( 'body' ).removeClass( 'hongo-body-overlay' ); 158 $( '.widget_shopping_cart' ).removeClass( 'open' ); 159 $( '.hongo-top-account-menu' ).removeClass( 'open' ); 160 }); 161 162 /* Left Menu Acoount Menu Open */ 163 $( document ).on( 'click', '.hongo-top-account-menu .account-menu-link', function() { 164 if ( $( this ).parents( '.hongo-top-account-menu' ).hasClass( 'open' ) || ! ( $( this ).parents( '.hongo-top-account-menu' ).find( '.hongo-account-menu-wrap' ).length > 0 ) ) { 165 //$( '.hongo-overlay' ).trigger( 'click' ); 166 $( 'body' ).removeClass( 'hongo-body-overlay' ); 167 $( '.widget_shopping_cart' ).removeClass( 'open' ); 168 $( '.hongo-top-account-menu' ).removeClass( 'open' ); 169 } else { 170 if ( $( '.widget_shopping_cart').hasClass( 'open' ) ) { 171 $( '.widget_shopping_cart').removeClass( 'open' ); 172 $( '.hongo-top-account-menu').addClass( 'open' ); 173 } else { 174 $( this).parents( '.hongo-top-account-menu' ).addClass( 'open' ); 175 $( 'body').addClass( 'hongo-body-overlay' ); 176 } 177 } 178 }); 179 180 /* Left Menu Mini Cart Open */ 181 $( document ).on( 'click', '.hongo-main-wrap .hongo-top-cart-wrapper', function() { 182 if ($(window).width() < 768) { 183 window.location.replace( hongoAddons.cart_url ); 184 } else { 185 if ( $( this ).parents( '.widget_shopping_cart' ).hasClass( 'open' ) ) { 186 $( 'body' ).removeClass( 'hongo-body-overlay' ); 187 $( '.widget_shopping_cart' ).removeClass( 'open' ); 188 $( '.hongo-top-account-menu' ).removeClass( 'open' ); 189 } else { 190 if ( $( '.hongo-top-account-menu').hasClass( 'open' ) ) { 191 $( '.hongo-top-account-menu').removeClass( 'open' ); 192 $( '.widget_shopping_cart').addClass( 'open' ); 193 } else{ 194 $( this ).parents( '.widget_shopping_cart' ).addClass( 'open' ); 195 $( 'body' ).addClass( 'hongo-body-overlay' ); 196 } 197 } 198 } 199 }); 200 } 201 202 /* Hamburger menu toggle */ 203 if( $('.hongo-hamburger-menu').length > 0 ) { 204
205 $( document ).on( 'click', '.menu-hamburger-menu-wrap li .menu-dropdown-toggle', function() { 206 207 $(this).parent('li').toggleClass( function() { 208 $( this ).siblings().removeClass( 'on' ); 209 $( this ).siblings().find('.dropdown-menu li').removeClass( 'on' ); 210 $( this ).siblings().find('.dropdown-menu').slideUp(); 211 $( this ).children('.dropdown-menu').slideToggle(); 212 return "on"; 213 }); 214 }); 215 216 /* Hamburger menu open */ 217 $(document).on( 'click', '.hamburger-menu-button button, .hamburger-menu-button .mobile-menu-text', function () { 218 219 $( 'body' ).addClass( 'show-menu' ); 220 }); 221 222 /* Hamburger menu close */ 223 $(document).on( 'click', '.hongo-hamburger-menu-bg .close-button-menu', function () { 224 225 $( 'body' ).removeClass( 'show-menu' ); 226 $( '.menu-hamburger-menu-wrap li' ).siblings().removeClass( 'on' ); 227 $( '.menu-hamburger-menu-wrap li' ).siblings().find('.dropdown-menu').slideUp(); 228 }); 229 } 230 231 /* Header push ( Right side ) menu */ 232 if( $( '.header-push-menu-button button' ).length > 0 ) { 233 234 /* Header push menu open */ 235 $( document ).on( 'click', '.header-push-menu-button button', function() { 236 237 $( 'body' ).addClass( 'header-push-menu-open' ); 238 setTimeout( function() { 239 240 $( this ).addClass( 'active' ); 241 $( '.cbp-spmenu' ).addClass( 'cbp-spmenu-open' ); 242 }, 100 ); 243 }); 244 245 /* Header push menu close */ 246 $( document ).on( 'click', '.close-button-menu', function() { 247 248 $( '.header-push-menu-button button' ).removeClass( 'active' ); 249 $( '.cbp-spmenu' ).removeClass( 'cbp-spmenu-open' ); 250 setTimeout( function() { 251 252 $( 'body' ).removeClass( 'header-push-menu-open' ); 253 }, 100 ); 254 }); 255 } 256 257 // Parent menu active class added on ready 258 $( '.hongo-navigation-menu .menu li, .hongo-shop-dropdown-menu .menu li' ).each(function () { 259 260 var _this = $( this ); 261 if( $( '.menu-item', _this ).hasClass( 'current-menu-item' ) ) { 262 263 _this.addClass( 'active' ); 264 } 265 }); 266 267 /* Menu toggle */ 268 $( document ).on( 'click', '.navbar-collapse [data-toggle="dropdown"]', function (event) { 269 var $innerLinkLI = $(this).parents('ul.navbar-nav').find('li.dropdown.inner-link a').parent('li.dropdown'); 270 if (!$(this).parent().hasClass('inner-link') && !$(this).hasClass('dropdown-toggle') && $innerLinkLI.hasClass('open')) { 271 $innerLinkLI.removeClass('open'); 272 } 273 var target = $(this).attr('target'); 274 if ($(window).width() <= hongoAddons.menu_breakpoint && $(this).attr('href') && $(this).attr('href').indexOf("#") <= -1 && !$(event.target).is('i')) { 275 if ( event.ctrlKey || event.metaKey ) { 276 window.open($(this).attr('href'), "_blank"); 277 return false; 278 } else if ( ! target ) { 279 window.location = $(this).attr('href'); 280 } else { 281 window.open($(this).attr('href'), target); 282 } 283 284 } else if ($(window).width() > hongoAddons.menu_breakpoint && $(this).attr('href') && $(this).attr('href').indexOf("#") <= -1) { 285 if ( event.ctrlKey || event.metaKey ) { 286 window.open($(this).attr('href'), "_blank"); 287 return false; 288 } else if (!target) { 289 window.location = $(this).attr('href'); 290 } else { 291 window.open($(this).attr('href'), target); 292 } 293 294 } else if ($(window).width() <= hongoAddons.menu_breakpoint && $(this).attr('href') && $(this).attr('href').length > 1 && $(this).attr('href').indexOf("#") >= 0 && $(this).parent().hasClass('inner-link')) { 295 $(this).parents('ul.navbar-nav').find('li.dropdown').not($(this).parent('.dropdown')).removeClass('open'); 296 if ($(this).parent('.dropdown').hasClass('open')) { 297 $(this).parent('.dropdown').removeClass('open'); 298 } else { 299 $(this).parent('.dropdown').addClass('open'); 300 } 301 $(this).toggleClass('active'); 302 } else if( $(window).width() > hongoAddons.menu_breakpoint && $(window).width() <= 1199 ) { 303 if ( ! $(this).parent('.dropdown').hasClass('open') ) { 304 $(this).parent('.dropdown').removeClass( 'on' ); 305 } 306 } 307 }); 308 309 /* Touchstart click */ 310 $( document ).on( 'touchstart click', 'body', function (e) { 311 if ( $(window).width() <= hongoAddons.menu_breakpoint ) { 312 if ( ! $('.navbar-collapse').has(e.target).is('.navbar-collapse') && $('.navbar-collapse').hasClass('in') && !$(e.target).hasClass('navbar-toggle') ) { 313 $('.navbar-collapse').collapse('hide'); 314 } 315 } else { 316 if ( ! $('.navbar-collapse').has(e.target).is('.navbar-collapse') && $('.navbar-collapse ul').hasClass('in')) { 317 $('.navbar-collapse').find('a.dropdown-toggle').addClass('collapsed'); 318 $('.navbar-collapse').find('ul.dropdown-menu').removeClass('in'); 319 $('.navbar-collapse a.dropdown-toggle').removeClass('active'); 320 } 321 } 322 }); 323 324 /* Mobile menu button click active class */ 325 if( $( '.hongo-navigation-main-wrapper button.toggle-mobile, .hongo-left-menu-wrap button.toggle-mobile' ).length > 0 ) { 326 327 $( '.hongo-navigation-main-wrapper .navbar-collapse, .hongo-left-menu-wrap .hongo-left-menu-wrapper' ).on( 'show.bs.collapse', function() { 328 329 $( this ).parent().children( 'button.toggle-mobile' ).addClass( 'active' ); 330 331 }).on( 'hide.bs.collapse', function() { 332 333 $( this ).parent().children( 'button.toggle-mobile' ).removeClass( 'active' ); 334 }); 335 } 336 337 /* Mini header navigation menu responsive toggle */ 338 $( '.mini-header-main-wrapper .wp-nav-menu-responsive-button' ) 339 .on( 'mouseenter', function( e ) { 340 341 e.preventDefault(); 342 343 var $parent_obj = $( this ).parent().parent(); 344 $parent_obj.addClass( 'active' ); 345 346 $parent_obj.children( 'div:eq(1)' ).slideDown( "300" ); 347 348 }).on( 'mouseleave', function( e ) { 349 350 e.preventDefault(); 351 352 var $parent_obj = $( this ).parent().parent(); 353 $parent_obj.removeClass( 'active' ); 354
355 $parent_obj.children( 'div:eq(1)' ).slideUp( "300" ); 356 }); 357 358 $( '.mini-header-main-wrapper .wp-nav-menu-responsive-button' ).on( 'touchstart', function() { 359 360 var $parent_obj = $( this ).parent().parent(); 361 if( $parent_obj.hasClass( 'active' ) ) { 362 363 $parent_obj.removeClass( 'active' ); 364 $parent_obj.children( 'div:eq(1)' ).slideUp( "300" ); 365 366 } else { 367 368 $parent_obj.addClass( 'active' ); 369 $parent_obj.children( 'div:eq(1)' ).slideDown( "300" ); 370 } 371 }); 372 373 }); // End ready event 374 375 // Window resize event start code 376 $( window ).resize( function () { 377 378 // Header height adjustment 379 hongoAddonsReadyResize(); 380 hongoAddonsInitScrollNavigate(); 381 382 }); // End resize event 383 384 // Window orientationchange event start code 385 $( window ).on( "orientationchange", function( event ) { 386 387 setTimeout( function() { 388 389 hongoAddonsInitScrollNavigate(); 390 391 }, 10 ); 392 393 }); // End orientationchange event 394 395 // Window scroll event start code 396 var lastScroll = 0; 397 var menuScroll = 0; 398 $( window ).on( 'scroll', hongoAddonsInitScrollNavigate ); 399 function hongoAddonsInitScrollNavigate( e ) { 400 401 var scrollTopPos = $( document ).scrollTop(); 402 var mini_header_height = 0, top_header_height = 0, main_header_height = 0; 403 var aboveHeaderHeight = 0, aboveTopPosition = 0, wpadminbarHeight = 0; 404 var ts_height = 0; 405 406 /* One Page Navigation JS */ 407 var menu_links = $( "header .menu li a" ); 408 var scrollNavPos = scrollTopPos + 61; 409 410 menu_links.each(function () { 411 var currLink = $(this); 412 var hasPos = currLink.attr("href").indexOf("#"); 413 if( hasPos > -1 ) { 414 var res = currLink.attr("href").substring( hasPos ); 415 if ( res != '' && res != '#' && $( res ).length > 0 ) { 416 var refElement = $( res ); 417 if (refElement.offset().top <= scrollNavPos && refElement.offset().top + refElement.height() > scrollNavPos) { 418 menu_links.not( currLink ).removeClass("active"); 419 currLink.addClass("active"); 420 } else if( $( 'header .menu li a.active' ).length > 1 ) { 421 currLink.removeClass("active"); 422 } 423 } 424 } 425 }); 426 427 // Hide dropdown menu on scroll 428 if( scrollNavPos >= 200 ) { 429 430 $( '.header-push-menu-button button' ).removeClass( 'active' ); 431 $( '.cbp-spmenu' ).removeClass( 'cbp-spmenu-open' ); 432 setTimeout( function() { 433 434 $( 'body' ).removeClass( 'header-push-menu-open' ); 435 }, 100 ); 436 437 if( ! ( $( '.hongo-navigation-main-wrapper .navbar-toggle' ).hasClass( 'collapsed' ) ) ) { 438 439 $( '.hongo-navigation-main-wrapper .navbar-toggle' ).addClass( 'collapsed' ); 440 } 441 if( $( '.hongo-navigation-main-wrapper .navbar-collapse.collapse' ).hasClass( 'in' ) ) { 442 443 $( '.hongo-navigation-main-wrapper .navbar-collapse.collapse' ).removeClass( 'in' ); 444 } 445 $( '.hongo-navigation-main-wrapper button.toggle-mobile' ).removeClass( 'active' ); 446 } 447 448 setTimeout( function() { // Required for iPad safari 449 450 if( scrollTopPos > 0 || $scroll_flag ) { 451 452 if( $( '.admin-bar #wpadminbar' ).length > 0 ) { 453 454 wpadminbarHeight = $( '.admin-bar #wpadminbar' ).outerHeight(); 455 wpadminbarHeight = Math.round( wpadminbarHeight ); 456 } 457 458 /* Mini Header */ 459 if( $( '.mini-header-main-wrapper' ).length > 0 ) { 460 461 var miniHeaderObj = $( '.mini-header-main-wrapper' ); 462 mini_header_height = miniHeaderObj.outerHeight(); 463 ts_height = ts_height + mini_header_height; 464 } 465 466 /* Header top wrapper*/ 467 if( $( '.top-header-main-wrapper' ).length > 0 ) { 468 469 var topHeaderObj = $( '.top-header-main-wrapper' ); 470 top_header_height = topHeaderObj.outerHeight(); 471 ts_height = ts_height + top_header_height; 472 } 473 474 /* Header main */ 475 if( $( '.header-main-wrapper' ).length > 0 ) { 476 477 var mainHeaderObj = $( '.header-main-wrapper' ); 478 main_header_height = mainHeaderObj.outerHeight(); 479 ts_height = ts_height + main_header_height; 480 } 481 482 var headerAppearFlag = false;
483 if( scrollTopPos > ts_height ) { // Scroll position is greater than header height 484 485 headerAppearFlag = true; 486 } 487 488 /* Mini Header */ 489 if( $( '.mini-header-main-wrapper' ).length > 0 ) { 490 491 var miniHeaderObj = $( '.mini-header-main-wrapper' ); 492 mini_header_height = miniHeaderObj.outerHeight(); 493 mini_header_height = Math.round( mini_header_height ); 494 495 miniHeaderObj.css( 'margin-top', '0px' ); 496 497 if( miniHeaderObj.hasClass( 'appear-up-scroll' ) ) { 498 499 if( scrollTopPos < lastScroll ) { 500 501 if( headerAppearFlag ) { 502 503 aboveHeaderHeight = aboveHeaderHeight + mini_header_height; 504 } 505 miniHeaderObj.addClass( 'sticky-appear' ); 506 miniHeaderObj.css( 'top', wpadminbarHeight + 'px' ); 507 508 } else if( scrollTopPos > lastScroll ) { 509 510 if( headerAppearFlag ) { 511 512 var positionTop = mini_header_height + 1; 513 if( $( '.header-main-wrapper' ).length > 0 && ! mainHeaderObj.hasClass( 'appear-down-scroll' ) ) { 514 positionTop = positionTop + main_header_height; 515 } 516 if( $( '.top-header-main-wrapper' ).length > 0 && ! topHeaderObj.hasClass( 'appear-down-scroll' ) ) { 517 positionTop = positionTop + top_header_height; 518 } 519 miniHeaderObj.css( 'top', '-' + ( positionTop ) + 'px' ); 520 } 521 miniHeaderObj.removeClass( 'sticky-appear' ); // I have commented because its create issue in mobile 522 } 523 524 } else if( miniHeaderObj.hasClass( 'appear-down-scroll' ) ) { 525 526 if( headerAppearFlag ) { 527 528 aboveHeaderHeight = aboveHeaderHeight + mini_header_height; 529 miniHeaderObj.addClass( 'sticky-appear' ); 530 } 531 532 } else { 533 534 if( scrollTopPos < lastScroll ) { // Back scroll 535 536 if( ! headerAppearFlag ) { // Header is not sticky 537 538 miniHeaderObj.css( 'top', wpadminbarHeight + 'px' ); 539 540 } else { // Header is sticky 541 542 var positionTop = wpadminbarHeight + mini_header_height + 1; 543 if( $( '.header-main-wrapper' ).length > 0 && ! ( mainHeaderObj.hasClass( 'appear-down-scroll' ) || mainHeaderObj.hasClass( 'appear-up-scroll' ) ) ) { 544 positionTop = positionTop + main_header_height; 545 } 546 if( $( '.top-header-main-wrapper' ).length > 0 && ! ( topHeaderObj.hasClass( 'appear-down-scroll' ) || topHeaderObj.hasClass( 'appear-up-scroll' ) ) ) { 547 positionTop = positionTop + top_header_height; 548 } 549 miniHeaderObj.css( 'top', '-' + ( positionTop ) + 'px' ); 550 } 551 552 } else if( scrollTopPos > lastScroll ) { 553 554 if( headerAppearFlag ) { // Header is sticky 555 556 var positionTop = mini_header_height + 1; 557 if( $( '.header-main-wrapper' ).length > 0 && ! mainHeaderObj.hasClass( 'appear-down-scroll' ) ) { 558 positionTop = positionTop + main_header_height; 559 } 560 if( $( '.top-header-main-wrapper' ).length > 0 && ! topHeaderObj.hasClass( 'appear-down-scroll' ) ) { 561 positionTop = positionTop + top_header_height; 562 }
563 miniHeaderObj.css( 'top', '-' + ( positionTop ) + 'px' ); 564 } 565 } 566 } 567 } 568 569 /* Header top wrapper*/ 570 if( $( '.top-header-main-wrapper' ).length > 0 ) { 571 572 var topHeaderObj = $( '.top-header-main-wrapper' ); 573 top_header_height = topHeaderObj.outerHeight(); 574 top_header_height = Math.round( top_header_height ); 575 576 if( headerAppearFlag && scrollTopPos > 0 ) { 577 578 topHeaderObj.css( 'margin-top', ( aboveHeaderHeight ) + 'px' ); 579 580 } else { 581 582 topHeaderObj.css( 'margin-top', ( mini_header_height ) + 'px' ); 583 } 584 585 if( topHeaderObj.hasClass( 'appear-up-scroll' ) ) { 586 587 if( scrollTopPos < lastScroll ) { 588 589 if( headerAppearFlag ) { 590 591 aboveHeaderHeight = aboveHeaderHeight + top_header_height; 592 } 593 topHeaderObj.addClass( 'sticky-appear' ); 594 topHeaderObj.css( 'top', wpadminbarHeight + 'px' ); 595 596 } else if( scrollTopPos > lastScroll ) { 597 598 if( headerAppearFlag ) { 599 600 var positionTop = top_header_height + 1; 601 if( $( '.header-main-wrapper' ).length > 0 && ! mainHeaderObj.hasClass( 'appear-down-scroll' ) ) { 602 positionTop = positionTop + main_header_height; 603 } 604 topHeaderObj.css( 'top', '-' + ( positionTop ) + 'px' ); 605 } 606 topHeaderObj.removeClass( 'sticky-appear' ); // I have commented because its create issue in mobile 607 } 608 609 } else if( topHeaderObj.hasClass( 'appear-down-scroll' ) ) { 610 611 if( headerAppearFlag ) { 612 613 aboveHeaderHeight = aboveHeaderHeight + top_header_height; 614 topHeaderObj.addClass( 'sticky-appear' ); 615 } 616 617 } else { 618 619 if( scrollTopPos < lastScroll ) { 620 621 if( ! headerAppearFlag ) { 622 623 topHeaderObj.css( 'top', wpadminbarHeight + 'px' ); 624 625 } else { 626 627 var positionTop = wpadminbarHeight + top_header_height + 1; 628 if( $( '.header-main-wrapper' ).length > 0 && ! ( mainHeaderObj.hasClass( 'appear-down-scroll' ) || mainHeaderObj.hasClass( 'appear-up-scroll' ) ) ) { 629 positionTop = positionTop + main_header_height; 630 } 631 topHeaderObj.css( 'top', '-' + ( positionTop ) + 'px' ); 632 } 633 634 } else if( scrollTopPos > lastScroll ) { 635 636 if( headerAppearFlag ) { 637 638 var positionTop = top_header_height + 1; 639 if( $( '.header-main-wrapper' ).length > 0 && ! mainHeaderObj.hasClass( 'appear-down-scroll' ) ) { 640 positionTop = positionTop + main_header_height; 641 } 642 topHeaderObj.css( 'top', '-' + ( positionTop ) + 'px' ); 643 } 644 } 645 } 646 } 647 648 /* Header main */ 649 if( $( '.header-main-wrapper' ).length > 0 ) { 650 651 var mainHeaderObj = $( '.header-main-wrapper' ); 652 main_header_height = mainHeaderObj.outerHeight(); 653 main_header_height = Math.round( main_header_height ); 654 655 if( headerAppearFlag && scrollTopPos > 0 ) { 656 657 mainHeaderObj.css( 'margin-top', ( aboveHeaderHeight ) + 'px' ); 658 659 } else { 660 661 mainHeaderObj.css( 'margin-top', ( mini_header_height + top_header_height ) + 'px' ); 662 } 663
664 if( mainHeaderObj.hasClass( 'appear-up-scroll' ) ) { 665 666 if( scrollTopPos < lastScroll ) { // Back scroll 667 if( headerAppearFlag ) { 668 669 aboveHeaderHeight = aboveHeaderHeight + main_header_height; 670 } 671 mainHeaderObj.addClass( 'sticky-appear' ); 672 mainHeaderObj.css( 'top', wpadminbarHeight + 'px' ); 673 674 } else if( scrollTopPos > lastScroll ) { 675 if( headerAppearFlag ) { 676 677 var positionTop = main_header_height + 1; 678 mainHeaderObj.css( 'top', '-' + ( positionTop ) + 'px' ); 679 } 680 mainHeaderObj.removeClass( 'sticky-appear' ); // I have commented because its create issue in mobile 681 } 682 683 } else if( mainHeaderObj.hasClass( 'appear-down-scroll' ) ) { 684 685 if( headerAppearFlag ) { 686 687 aboveHeaderHeight = aboveHeaderHeight + main_header_height; 688 mainHeaderObj.addClass( 'sticky-appear' ); 689 } 690 691 } else { 692 693 if( scrollTopPos < lastScroll ) { 694 695 if( ! headerAppearFlag ) { 696 697 mainHeaderObj.css( 'top', wpadminbarHeight + 'px' ); 698 699 } 700 701 } else if( scrollTopPos > lastScroll ) { 702 703 if( headerAppearFlag ) { 704 705 var positionTop = main_header_height + 1; 706 mainHeaderObj.css( 'top', '-' + ( positionTop ) + 'px' ); 707 } 708 } 709 } 710 } 711 712 if( scrollTopPos > ts_height ) { 713 714 $( 'header.site-header:not( .hongo-main-wrap header )' ).addClass( 'header-sticky' ); 715 716 } else { 717 718 $( 'header:not( .hongo-main-wrap header )' ).removeClass( 'header-sticky' ); 719 $( '.mini-header-main-wrapper, .top-header-main-wrapper, .header-main-wrapper' ).removeClass( 'sticky-appear' ); 720 } 721 722 lastScroll = scrollTopPos; 723 if( lastScroll <= 0 ) { 724 725 $( 'header:not( .hongo-main-wrap header )' ).removeClass( 'header-sticky' ); 726 $( '.mini-header-main-wrapper, .top-header-main-wrapper, .header-main-wrapper' ).removeClass( 'sticky-appear' ); 727 } 728 } 729 }, 100 ); // Required for iPad safari 730 } 731 732 // Header height adjustment 733 function hongoAddonsReadyResize() { 734 735 // Main navigation dynamic height 736 if( $( window ).width() > hongoAddons.menu_breakpoint ) { 737 738 // Center logo with secondary menu 739 if( $( '.header-main-wrapper .hongo-navigation-main-wrapper' ).length > 1 ) { 740 $( '.header-main-wrapper .hongo-navigation-main-wrapper' ).each( function( index, value ) { 741 742 if( index == 0 ) { 743 744 $( '.hongo-navigation-menu', this ).find( '.hongo-mobile-secondary-menu' ).remove(); 745 $( '.hongo-desktop-secondary-menu-wrap' ).show(); 746 } 747 } ); 748 } 749 750 // One page navigation on class for line 751 $( '.hongo-navigation-menu .menu li.inner-link' ) 752 .on( 'mouseenter', function( e ) { 753 754 var _this = $( this ); 755 _this.addClass( 'on' ); 756 _this.siblings( '.on' ).removeClass( 'on' ); 757 758 }) 759 .on( 'mouseleave', function( e ) { 760 $( this ).removeClass( 'on' ); 761 }); 762 763 // Mega Menu Height code 764 $( '.hongo-navigation-menu .menu li:not(.inner-link), .hongo-shop-dropdown-menu .menu li' ) 765 .on( 'mouseenter', function( e ) { 766 767 var _this = $( this ); 768 _this.addClass( 'on' ); 769 _this.siblings( '.on' ).removeClass( 'on' ); 770 771 var windowHeight = $( window ).height(); 772 windowHeight = parseInt( windowHeight ); 773 774 var dropdown_menu_height = $( '.hongo-shop-dropdown-menu ul.navbar-nav' ).outerHeight() + 1; 775 $( '.hongo-shop-dropdown-menu .shop-mega-menu-wrapper' ).css( 'min-height', dropdown_menu_height + 'px' ); 776 777 if( $( '.mega-menu-main-wrapper .container', _this ).length > 0 ) { // Mega menu 778 779 var sub_menu_height = _this.find( '.mega-menu-main-wrapper .container' ).outerHeight(); 780 sub_menu_height = parseInt( sub_menu_height ); 781 782 if( sub_menu_height > ( windowHeight - 140 ) ) { 783 784 _this.children( '.mega-menu-main-wrapper' ).addClass( 'overflow-y' ).height( ( windowHeight - 140 ) ).show(); 785 786 } else { 787 788 _this.children( '.mega-menu-main-wrapper' ).removeClass( 'overflow-y' ).height( sub_menu_height ).show(); 789 } 790 791 } else if( $( '.sub-menu', _this ).length > 0 && _this.hasClass( 'dropdown' ) ) { // Simple menu 792 793 var sub_menu_height = $( '.simple-menu .sub-menu', _this ).outerHeight(); 794 sub_menu_height = parseInt( sub_menu_height ); 795 796 if( sub_menu_height > ( windowHeight - 140 ) ) { 797 798 _this.children( '.mega-menu-main-wrapper' ).addClass( 'overflow-y' ).height( ( windowHeight - 140 ) ).show(); 799 800 } else { 801 802 _this.children( '.mega-menu-main-wrapper' ).removeClass( 'overflow-y' ).height( sub_menu_height ).show(); 803 } 804 } 805 806 }) 807 .on( 'mouseleave', function( e ) { 808 809 $( this ).children( '.mega-menu-main-wrapper' ).height(0); 810 $( this ).removeClass( 'on' ); 811 }); 812 813 if( isiPhoneiPad ) { 814 $( 'section:not( header section )' ).on( 'click', function() { 815 816 // This event trigger for close megamenu so menu mouseleave event has triggered 817 }); 818 } 819 820 // Simple Menu Height 821 $( '.hongo-navigation-menu .menu li.simple-dropdown:not(.inner-link)' ) 822 .on( 'mouseenter', function( e ) { 823 824 var _this = $( this ); 825 826 var windowHeight = $( window ).height(); 827 windowHeight = parseInt( windowHeight ); 828 829 var sub_menu_height = _this.find( '.sub-menu' ).outerHeight(); 830 sub_menu_height = parseInt( sub_menu_height ); 831 832 if( sub_menu_height > ( windowHeight - 100 ) ) { 833 834 _this.children( '.menu-wrap-div' ).addClass( 'overflow-y' ).height( ( windowHeight - 100 ) ).show(); 835 836 } else { 837 838 _this.children( '.menu-wrap-div' ).removeClass( 'overflow-y' ).height( sub_menu_height ).show(); 839 } 840 841 setTimeout( function() { 842 _this.addClass( 'simple-menu-open' ); 843 }, 500 ); 844 }) 845 .on( 'mouseleave', function( e ) { 846 847 $( this ).children( '.menu-wrap-div' ).height(0); 848 $( this ).removeClass('on').removeClass( 'simple-menu-open' ); 849 }); 850 851 $( '.hongo-navigation-menu .menu li a, .hongo-shop-dropdown-menu .menu li a, .hongo-navigation-menu .menu li.simple-dropdown a' ).on( 'click', function() { 852 853 if( $( '.menu-wrap-div', $( this ).parent() ).length > 0 ) { 854 855 return true; 856 } 857 }); 858 859 $( '.hongo-navigation-menu .menu li.simple-dropdown:not(.inner-link) .dropdown-toggle, .hongo-navigation-menu .menu li:not(.inner-link) .dropdown-toggle, .hongo-shop-dropdown-menu .menu li .dropdown-toggle' ).on( 'touchstart', function() { 860 $( this ).parents( 'li' ).trigger( 'mouseenter' ); 861 }); 862 863 // Display inline block for with categories menu above breakpoint 864 $( '.hongo-navigation-tab-wrap .hongo-tab.panel' ).css( 'display', 'inline-block' ); 865 866 } else { 867 868 $( '.mega-menu-main-wrapper' ).removeClass( 'overflow-y' ) 869 870 // Center logo with secondary menu 871 var centerLogoMenusObj = $( '.header-main-wrapper .hongo-navigation-main-wrapper:not( .hongo-navigation-main-wrapper .hongo-navigation-main-wrapper )' ); 872 if( centerLogoMenusObj.length > 1 && ! ( $( '.hongo-mobile-secondary-menu' ).length > 0 ) ) { 873 centerLogoMenusObj.each( function( index, value ) { 874 875 if( index == 0 && $( this ).parents( 'section' ).find( '.hongo-navigation-main-wrapper' ).length > 1 ) { 876 877 var secondary_menu_obj = centerLogoMenusObj.eq( 1 ).find( '.hongo-navigation-menu' ), 878 secondary_menu_html = secondary_menu_obj.html(); 879 $( '.hongo-navigation-menu:not( .hongo-navigation-main-wrapper .hongo-navigation-main-wrapper .hongo-navigation-menu )', this ).find( '.hongo-mobile-secondary-menu' ).remove(); 880 $( '.hongo-navigation-menu:not( .hongo-navigation-main-wrapper .hongo-navigation-main-wrapper .hongo-navigation-menu )', this ).append( secondary_menu_html ); 881 $( '.hongo-navigation-menu:not( .hongo-navigation-main-wrapper .hongo-navigation-main-wrapper .hongo-navigation-menu )', this ).children( '.hongo-menu-wrap:eq(1)' ).addClass( 'hongo-mobile-secondary-menu' ); 882 secondary_menu_obj.parents( '.hongo-navigation-main-wrapper' ).addClass( 'hongo-desktop-secondary-menu-wrap' ).hide(); 883 } 884 } ); 885 } 886 887 if( $( '.mega-menu-main-wrapper' ).parent().hasClass( 'on' ) ) { 888 889 $( '.mega-menu-main-wrapper' ).height( 'auto' ); 890 } 891 $( '.hongo-navigation-menu .menu li, .hongo-shop-dropdown-menu .menu li' ).removeClass( 'on' ); 892 893 } 894 895 setTimeout( function() { 896 897 var ts_height = hongoAddonsGetTopSpaceHeight(); 898 899 // For full screen 900 $( ".full-screen" ).each( function() { 901 902 var element = $( this ); 903 element.parents('section').imagesLoaded( function () { 904 var minheight = $( window ).height(); 905 if( element.parents('section').hasClass( 'top-space' ) || element.parents('section').hasClass( 'top-space-padding' ) ) { 906 minheight = minheight - ts_height; 907 } 908 element.children( '.vc_column-inner' ).css( 'min-height', minheight ); 909 element.css( 'min-height', minheight ); 910 }); 911 }); 912 913 // For slider full screen 914 $( ".slider-full-screen" ).each( function() { 915 916 var element = $( this ); 917 element.parents('section').imagesLoaded( function () { 918 var height = $( window ).height(); 919 if( element.parents('section').hasClass( 'top-space' ) || element.parents('section').hasClass( 'top-space-padding' ) ) { 920 height = height - ts_height; 921 } 922 element.css( 'height', height ); 923 }); 924 }); 925 926 var adminBarHeight = 0; 927 if( $('.admin-bar').length > 0 ) { 928 adminBarHeight = 32; 929 } 930 var smoothHeaderHeight = adminBarHeight; 931 if( $( '.appear-down-scroll' ).length && $('.navbar').length ) { 932 smoothHeaderHeight = smoothHeaderHeight + $('.navbar').outerHeight(); 933 } 934 935 if( $.inArray( 'smooth-scroll', hongoAddons.disable_scripts ) < 0 ) { 936 $('.inner-link a').smoothScroll({ 937 speed: 900, 938 offset: -( smoothHeaderHeight - 10 ), 939 beforeScroll: function() { $( '#close-button' ).trigger( 'click' ); } 940 }); 941 } 942 943 }, 10 ); 944 945 // Footer sticky 946 if( $( '.footer-sticky' ).length > 0 ) { 947 // Added class into body while footer sticky is exist 948 $( 'body' ).addClass( 'hongo-contain-footer-sticky' ); 949 950 var ua = window.navigator.userAgent; 951 var msie = ua.indexOf("MSIE "); 952 var msEdge = ua.indexOf("Edge/"); 953 var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 954 955 if ( is_safari ) { 956 $(window).scroll(function() { 957 $('footer').css('z-index', '-1'); 958 clearTimeout($.data(this, 'scrollTimer')); 959 $.data(this, 'scrollTimer', setTimeout(function() { 960 $('footer').css('z-index', '0'); 961 }, 250)); 962 }); 963 } 964 $( '.footer-sticky' ).prev().addClass( 'footer-sticky-content' ); 965 if ( msEdge > 0 || msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { // If Internet Explorer, return version number // is_safari || 966 setTimeout( function() { 967 968 var footer_height = $( '.footer-sticky' ).outerHeight() - 1; 969 if ( $(window).width() > 1024 ) { 970 971 $( '.footer-sticky-content' ).css( 'margin-bottom', footer_height + 'px' ); 972 } else { 973 $( '.footer-sticky-content' ).css( 'margin-bottom', '0px' ); 974 } 975 976 }, 10 ); 977 } 978 } 979 } 980 981 // Get top space height 982 function hongoAddonsGetTopSpaceHeight() { 983 984 var wp_adminbar_height = 0, default_header_height = 0, mini_header_height = 0, top_header_height = 0, main_header_height = 0, mini_header_ts_height = 0, top_header_ts_height = 0, main_header_ts_height = 0, ts_height = 0; 985 if( $( '.mini-header-main-wrapper' ).length > 0 ) { 986 987 mini_header_height = $( '.mini-header-main-wrapper' ).outerHeight(); 988 989 top_header_ts_height = top_header_ts_height + mini_header_height; 990 main_header_ts_height = main_header_ts_height + mini_header_height; 991 ts_height = ts_height + mini_header_height; 992 } 993 if( $( '.top-header-main-wrapper' ).length > 0 ) { 994 995 top_header_height = $( '.top-header-main-wrapper' ).outerHeight(); 996 997 main_header_ts_height = main_header_ts_height + top_header_height; 998 ts_height = ts_height + top_header_height; 999 } 1000 if( $( '.header-main-wrapper' ).length > 0 ) { 1001 1002 main_header_height = $( '.header-main-wrapper' ).outerHeight(); 1003 1004 ts_height = ts_height + main_header_height; 1005 } 1006 1007 if( ! ( $( '.header-default-wrapper' ).length > 0 ) ) { 1008 1009 $( 'header.site-header:not( .hongo-main-wrap header )' ).height( ts_height + 'px' ); 1010 1011 } else { 1012 1013 default_header_height = $( '.header-default-wrapper' ).outerHeight(); 1014 1015 ts_height = ts_height + default_header_height; 1016 } 1017 1018 $( '.top-space' ).css( 'margin-top', ts_height + 'px' ); 1019 if( $( '.hongo-main-title-wrap' ).length > 0 && $( '.top-space-padding' ).length > 0 ) { 1020 var padding_top = $( '.hongo-main-title-wrap' ).attr( 'data-
1020padding-top' ); 1021 if( padding_top == '' || padding_top == undefined ) { 1022 padding_top = $( '.hongo-main-title-wrap' ).css('padding-top'); 1023 $( '.hongo-main-title-wrap' ).attr( 'data-padding-top', padding_top ); 1024 } 1025 ts_height = parseInt( ts_height ) + parseInt( padding_top ); 1026 $( '.top-space-padding' ).css( 'padding-top', ts_height + 'px' ); 1027 } 1028 1029 return ts_height; 1030 } 1031 1032 /* Overwrite VC full height */ 1033 $( document ).on( 'vc-full-height-row', function( e ) { 1034 1035 var $element = $( ".vc_row-o-full-height:first" ); 1036 1037 var mini_header_height = 0, top_header_height = 0, main_header_height = 0, default_header_height = 0, ts_height = 0; 1038 if( $( '.mini-header-main-wrapper' ).length > 0 ) { 1039 1040 mini_header_height = $( '.mini-header-main-wrapper' ).outerHeight(); 1041 ts_height = ts_height + mini_header_height; 1042 } 1043 if( $( '.top-header-main-wrapper' ).length > 0 ) { 1044 1045 top_header_height = $( '.top-header-main-wrapper' ).outerHeight(); 1046 ts_height = ts_height + top_header_height; 1047 } 1048 if( $( '.header-main-wrapper' ).length > 0 ) { 1049 1050 main_header_height = $( '.header-main-wrapper' ).outerHeight(); 1051 ts_height = ts_height + main_header_height; 1052 } 1053 1054 if( $( '.header-default-wrapper' ).length > 0 ) { 1055 1056 default_header_height = $( '.header-default-wrapper' ).outerHeight(); 1057 ts_height = ts_height + default_header_height; 1058 } 1059 1060 if( $( '.hongo-main-title-wrap' ).length > 0 && $( '.top-space-padding' ).length > 0 ) { 1061 var padding_top = $( '.hongo-main-title-wrap' ).attr( 'data-padding-top' ); 1062 if( padding_top == '' || padding_top == undefined ) { 1063 padding_top = $( '.hongo-main-title-wrap' ).css('padding-top'); 1064 } 1065 ts_height = parseInt( ts_height ) + parseInt( padding_top ); 1066 } 1067 1068 if( $element.length ) { 1069 1070 var windowHeight = ( $( window ).height() ); 1071 1072 if( $element.hasClass( 'top-space' ) || $element.hasClass( 'top-space-padding' ) ) { 1073 windowHeight = windowHeight - ts_height; 1074 } 1075 1076 if( windowHeight ) { 1077 $element.css( "min-height", windowHeight + "px" ); 1078 } 1079 } 1080 }); 1081 1082 /* Overwrite VC full width row */ 1083 $( document ).on( 'vc-full-width-row', function( e ) { 1084 1085 var $elements = $( '[data-vc-full-width="true"]' ); 1086 $.each($elements, function(key, item) { 1087 var $el = $(this); 1088 $el.addClass("vc_hidden"); 1089 var $el_full = $el.next(".vc_row-full-width"); 1090 if ($el_full.length || ($el_full = $el.parent().next(".vc_row-full-width")), $el_full.length) { 1091 var padding, paddingRight, el_margin_left = parseInt($el.css("margin-left"), 10), 1092 el_margin_right = parseInt($el.css("margin-right"), 10), 1093 offset = 0 - $el_full.offset().left - el_margin_left, 1094 width = $(window).width(); 1095 1096 /* Box layout strach row code start */ 1097 if( $( '.box-layout' ).length > 0 ) { 1098 1099 var boxLayoutWidth = $( '.box-layout' ).width(); 1100 var boxWidth = ( width - boxLayoutWidth ) / 2; 1101 1102 offset = offset + boxWidth; 1103 width = width - ( boxWidth * 2 ); 1104 } 1105 /* Box layout strach row code end */ 1106 1107 /* Let menu strach row code start */ 1108 if( $( '.hongo-main-site-content' ).length > 0 ) { 1109 1110 var leftHeaderWidth = $( '.header-left-wrapper' ).width(); 1111 var leftMenuLayoutWidth = $( '.hongo-main-site-content' ).width(); 1112 1113 if( $(window).width() > 991 ) { 1114 1115 offset = offset + leftHeaderWidth; 1116 } 1117 width = leftMenuLayoutWidth; 1118 } 1119 /* Let menu strach row code end */ 1120 1121 if ("rtl" === $el.css("direction") && (offset -= $el_full.width(), offset += width, offset += el_margin_left, offset += el_margin_right), $el.css({ 1122 position: "relative", 1123 left: offset, 1124 "box-sizing": "border-box", 1125 width: width 1126 }), !$el.data("vcStretchContent")) "rtl" === $el.css("direction") ? ((padding = offset) < 0 && (padding = 0), (paddingRight = offset) < 0 && (paddingRight = 0)) : ((padding = -1 * offset) < 0 && (padding = 0), (paddingRight = width - padding - $el_full.width() + el_margin_left + el_margin_right) < 0 && (paddingRight = 0)), $el.css({ 1127 "padding-left": padding + "px", 1128 "padding-right": paddingRight + "px" 1129 }); 1130 $el.attr("data-vc-full-width-init", "true"), $el.removeClass("vc_hidden"), $(document).trigger("vc-full-width-row-single", { 1131 el: $el, 1132 offset: offset, 1133 marginLeft: el_margin_left, 1134 marginRight: el_margin_right, 1135 elFull: $el_full, 1136 width: width 1137 }); 1138 } 1139 }); 1140 }); 1141 1142})( jQuery );
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.