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 )" 715 ).addClass("header-sticky"); 716 } else { 717 $("header:not( .hongo-main-wrap header )").removeClass( 718 "header-sticky" 719 ); 720 $( 721 ".mini-header-main-wrapper, .top-header-main-wrapper, .header-main-wrapper" 722 ).removeClass("sticky-appear"); 723 } 724 725 lastScroll = scrollTopPos; 726 if( lastScroll <= 0 ) { 727 728 $( 'header:not( .hongo-main-wrap header )' ).removeClass( 'header-sticky' ); 729 $( '.mini-header-main-wrapper, .top-header-main-wrapper, .header-main-wrapper' ).removeClass( 'sticky-appear' ); 730 }*/ 731 } 732 }, 100 ); // Required for iPad safari 733 } 734 735 // Header height adjustment 736 function hongoAddonsReadyResize() { 737 738 // Main navigation dynamic height 739 if( $( window ).width() > hongoAddons.menu_breakpoint ) { 740 741 // Center logo with secondary menu 742 if( $( '.header-main-wrapper .hongo-navigation-main-wrapper' ).length > 1 ) { 743 $( '.header-main-wrapper .hongo-navigation-main-wrapper' ).each( function( index, value ) { 744 745 if( index == 0 ) { 746 747 $( '.hongo-navigation-menu', this ).find( '.hongo-mobile-secondary-menu' ).remove(); 748 $( '.hongo-desktop-secondary-menu-wrap' ).show(); 749 } 750 } ); 751 } 752 753 // One page navigation on class for line 754 $( '.hongo-navigation-menu .menu li.inner-link' ) 755 .on( 'mouseenter', function( e ) { 756 757 var _this = $( this ); 758 _this.addClass( 'on' ); 759 _this.siblings( '.on' ).removeClass( 'on' ); 760 761 }) 762 .on( 'mouseleave', function( e ) { 763 $( this ).removeClass( 'on' ); 764 }); 765 766 // Mega Menu Height code 767 $( '.hongo-navigation-menu .menu li:not(.inner-link), .hongo-shop-dropdown-menu .menu li' ) 768 .on( 'mouseenter', function( e ) { 769 770 var _this = $( this ); 771 _this.addClass( 'on' ); 772 _this.siblings( '.on' ).removeClass( 'on' ); 773 774 var windowHeight = $( window ).height(); 775 windowHeight = parseInt( windowHeight ); 776 777 var dropdown_menu_height = $( '.hongo-shop-dropdown-menu ul.navbar-nav' ).outerHeight() + 1; 778 $( '.hongo-shop-dropdown-menu .shop-mega-menu-wrapper' ).css( 'min-height', dropdown_menu_height + 'px' ); 779 780 if( $( '.mega-menu-main-wrapper .container', _this ).length > 0 ) { // Mega menu 781 782 var sub_menu_height = _this.find( '.mega-menu-main-wrapper .container' ).outerHeight(); 783 sub_menu_height = parseInt( sub_menu_height ); 784 785 if( sub_menu_height > ( windowHeight - 140 ) ) { 786 787 _this.children( '.mega-menu-main-wrapper' ).addClass( 'overflow-y' ).height( ( windowHeight - 140 ) ).show(); 788 789 } else { 790 791 _this.children( '.mega-menu-main-wrapper' ).removeClass( 'overflow-y' ).height( sub_menu_height ).show(); 792 } 793 794 } else if( $( '.sub-menu', _this ).length > 0 && _this.hasClass( 'dropdown' ) ) { // Simple menu 795 796 var sub_menu_height = $( '.simple-menu .sub-menu', _this ).outerHeight(); 797 sub_menu_height = parseInt( sub_menu_height ); 798 799 if( sub_menu_height > ( windowHeight - 140 ) ) { 800 801 _this.children( '.mega-menu-main-wrapper' ).addClass( 'overflow-y' ).height( ( windowHeight - 140 ) ).show(); 802 803 } else { 804 805 _this.children( '.mega-menu-main-wrapper' ).removeClass( 'overflow-y' ).height( sub_menu_height ).show(); 806 } 807 } 808 809 }) 810 .on( 'mouseleave', function( e ) { 811 812 $( this ).children( '.mega-menu-main-wrapper' ).height(0); 813 $( this ).removeClass( 'on' ); 814 }); 815 816 if( isiPhoneiPad ) { 817 $( 'section:not( header section )' ).on( 'click', function() { 818 819 // This event trigger for close megamenu so menu mouseleave event has triggered 820 }); 821 } 822 823 // Simple Menu Height 824 $( '.hongo-navigation-menu .menu li.simple-dropdown:not(.inner-link)' ) 825 .on( 'mouseenter', function( e ) { 826 827 var _this = $( this ); 828 829 var windowHeight = $( window ).height(); 830 windowHeight = parseInt( windowHeight ); 831 832 var sub_menu_height = _this.find( '.sub-menu' ).outerHeight(); 833 sub_menu_height = parseInt( sub_menu_height ); 834 835 if( sub_menu_height > ( windowHeight - 100 ) ) { 836 837 _this.children( '.menu-wrap-div' ).addClass( 'overflow-y' ).height( ( windowHeight - 100 ) ).show(); 838 839 } else { 840 841 _this.children( '.menu-wrap-div' ).removeClass( 'overflow-y' ).height( sub_menu_height ).show(); 842 } 843 844 setTimeout( function() { 845 _this.addClass( 'simple-menu-open' ); 846 }, 500 ); 847 }) 848 .on( 'mouseleave', function( e ) { 849 850 $( this ).children( '.menu-wrap-div' ).height(0); 851 $( this ).removeClass('on').removeClass( 'simple-menu-open' ); 852 }); 853 854 $( '.hongo-navigation-menu .menu li a, .hongo-shop-dropdown-menu .menu li a, .hongo-navigation-menu .menu li.simple-dropdown a' ).on( 'click', function() { 855 856 if( $( '.menu-wrap-div', $( this ).parent() ).length > 0 ) { 857 858 return true; 859 } 860 }); 861 862 $( '.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() { 863 $( this ).parents( 'li' ).trigger( 'mouseenter' ); 864 }); 865 866 // Display inline block for with categories menu above breakpoint 867 $( '.hongo-navigation-tab-wrap .hongo-tab.panel' ).css( 'display', 'inline-block' ); 868 869 } else { 870 871 $( '.mega-menu-main-wrapper' ).removeClass( 'overflow-y' ) 872 873 // Center logo with secondary menu 874 var centerLogoMenusObj = $( '.header-main-wrapper .hongo-navigation-main-wrapper:not( .hongo-navigation-main-wrapper .hongo-navigation-main-wrapper )' ); 875 if( centerLogoMenusObj.length > 1 && ! ( $( '.hongo-mobile-secondary-menu' ).length > 0 ) ) { 876 centerLogoMenusObj.each( function( index, value ) { 877 878 if( index == 0 && $( this ).parents( 'section' ).find( '.hongo-navigation-main-wrapper' ).length > 1 ) { 879 880 var secondary_menu_obj = centerLogoMenusObj.eq( 1 ).find( '.hongo-navigation-menu' ), 881 secondary_menu_html = secondary_menu_obj.html(); 882 $( '.hongo-navigation-menu:not( .hongo-navigation-main-wrapper .hongo-navigation-main-wrapper .hongo-navigation-menu )', this ).find( '.hongo-mobile-secondary-menu' ).remove(); 883 $( '.hongo-navigation-menu:not( .hongo-navigation-main-wrapper .hongo-navigation-main-wrapper .hongo-navigation-menu )', this ).append( secondary_menu_html ); 884 $( '.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' ); 885 secondary_menu_obj.parents( '.hongo-navigation-main-wrapper' ).addClass( 'hongo-desktop-secondary-menu-wrap' ).hide(); 886 } 887 } ); 888 } 889 890 if( $( '.mega-menu-main-wrapper' ).parent().hasClass( 'on' ) ) { 891 892 $( '.mega-menu-main-wrapper' ).height( 'auto' ); 893 } 894 $( '.hongo-navigation-menu .menu li, .hongo-shop-dropdown-menu .menu li' ).removeClass( 'on' ); 895 896 } 897 898 setTimeout( function() { 899 900 var ts_height = hongoAddonsGetTopSpaceHeight(); 901 902 // For full screen 903 $( ".full-screen" ).each( function() { 904 905 var element = $( this ); 906 element.parents('section').imagesLoaded( function () { 907 var minheight = $( window ).height(); 908 if( element.parents('section').hasClass( 'top-space' ) || element.parents('section').hasClass( 'top-space-padding' ) ) { 909 minheight = minheight - ts_height; 910 } 911 element.children( '.vc_column-inner' ).css( 'min-height', minheight ); 912 element.css( 'min-height', minheight ); 913 }); 914 }); 915 916 // For slider full screen 917 $( ".slider-full-screen" ).each( function() { 918 919 var element = $( this ); 920 element.parents('section').imagesLoaded( function () { 921 var height = $( window ).height(); 922 if( element.parents('section').hasClass( 'top-space' ) || element.parents('section').hasClass( 'top-space-padding' ) ) { 923 height = height - ts_height; 924 } 925 element.css( 'height', height ); 926 }); 927 }); 928 929 var adminBarHeight = 0; 930 if( $('.admin-bar').length > 0 ) { 931 adminBarHeight = 32; 932 } 933 var smoothHeaderHeight = adminBarHeight; 934 if( $( '.appear-down-scroll' ).length && $('.navbar').length ) { 935 smoothHeaderHeight = smoothHeaderHeight + $('.navbar').outerHeight(); 936 } 937 938 if( $.inArray( 'smooth-scroll', hongoAddons.disable_scripts ) < 0 ) { 939 $('.inner-link a').smoothScroll({ 940 speed: 900, 941 offset: -( smoothHeaderHeight - 10 ), 942 beforeScroll: function() { $( '#close-button' ).trigger( 'click' ); } 943 }); 944 } 945 946 }, 10 ); 947 948 // Footer sticky 949 if( $( '.footer-sticky' ).length > 0 ) { 950 // Added class into body while footer sticky is exist 951 $( 'body' ).addClass( 'hongo-contain-footer-sticky' ); 952 953 var ua = window.navigator.userAgent; 954 var msie = ua.indexOf("MSIE "); 955 var msEdge = ua.indexOf("Edge/"); 956 var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 957 958 if ( is_safari ) { 959 $(window).scroll(function() { 960 $('footer').css('z-index', '-1'); 961 clearTimeout($.data(this, 'scrollTimer')); 962 $.data(this, 'scrollTimer', setTimeout(function() { 963 $('footer').css('z-index', '0'); 964 }, 250)); 965 }); 966 } 967 $( '.footer-sticky' ).prev().addClass( 'footer-sticky-content' ); 968 if ( msEdge > 0 || msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { // If Internet Explorer, return version number // is_safari || 969 setTimeout( function() { 970 971 var footer_height = $( '.footer-sticky' ).outerHeight() - 1; 972 if ( $(window).width() > 1024 ) { 973 974 $( '.footer-sticky-content' ).css( 'margin-bottom', footer_height + 'px' ); 975 } else { 976 $( '.footer-sticky-content' ).css( 'margin-bottom', '0px' ); 977 } 978 979 }, 10 ); 980 } 981 } 982 } 983 984 // Get top space height 985 function hongoAddonsGetTopSpaceHeight() { 986 987 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; 988 if( $( '.mini-header-main-wrapper' ).length > 0 ) { 989 990 mini_header_height = $( '.mini-header-main-wrapper' ).outerHeight(); 991 992 top_header_ts_height = top_header_ts_height + mini_header_height; 993 main_header_ts_height = main_header_ts_height + mini_header_height; 994 ts_height = ts_height + mini_header_height; 995 } 996 if( $( '.top-header-main-wrapper' ).length > 0 ) { 997 998 top_header_height = $( '.top-header-main-wrapper' ).outerHeight(); 999 1000 main_header_ts_height = main_header_ts_height + top_header_height; 1001 ts_height = ts_height + top_header_height; 1002 } 1003 if( $( '.header-main-wrapper' ).length > 0 ) { 1004 1005 main_header_height = $( '.header-main-wrapper' ).outerHeight(); 1006 1007 ts_height = ts_height + main_header_height; 1008 } 1009 1010 if( ! ( $( '.header-default-wrapper' ).length > 0 ) ) { 1011 1012 $( 'header.site-header:not( .hongo-main-wrap header )' ).height( ts_height + 'px' ); 1013 1014 } else { 1015 1016 default_header_height = $( '.header-default-wrapper' ).outerHeight(); 1017 1018 ts_height = ts_height + default_header_height; 1019 } 1020 1021 $( '.top-space' ).css( 'margin-top', ts_height + 'px' ); 1022 if( $( '.hongo-main-title-wrap' ).length > 0 && $( '.top-space-padding' ).length > 0 ) { 1023 var padding_top = $( '.hongo-main-title-wrap' ).attr( 'data-
1023padding-top' ); 1024 if( padding_top == '' || padding_top == undefined ) { 1025 padding_top = $( '.hongo-main-title-wrap' ).css('padding-top'); 1026 $( '.hongo-main-title-wrap' ).attr( 'data-padding-top', padding_top ); 1027 } 1028 ts_height = parseInt( ts_height ) + parseInt( padding_top ); 1029 $( '.top-space-padding' ).css( 'padding-top', ts_height + 'px' ); 1030 } 1031 1032 return ts_height; 1033 } 1034 1035 /* Overwrite VC full height */ 1036 $( document ).on( 'vc-full-height-row', function( e ) { 1037 1038 var $element = $( ".vc_row-o-full-height:first" ); 1039 1040 var mini_header_height = 0, top_header_height = 0, main_header_height = 0, default_header_height = 0, ts_height = 0; 1041 if( $( '.mini-header-main-wrapper' ).length > 0 ) { 1042 1043 mini_header_height = $( '.mini-header-main-wrapper' ).outerHeight(); 1044 ts_height = ts_height + mini_header_height; 1045 } 1046 if( $( '.top-header-main-wrapper' ).length > 0 ) { 1047 1048 top_header_height = $( '.top-header-main-wrapper' ).outerHeight(); 1049 ts_height = ts_height + top_header_height; 1050 } 1051 if( $( '.header-main-wrapper' ).length > 0 ) { 1052 1053 main_header_height = $( '.header-main-wrapper' ).outerHeight(); 1054 ts_height = ts_height + main_header_height; 1055 } 1056 1057 if( $( '.header-default-wrapper' ).length > 0 ) { 1058 1059 default_header_height = $( '.header-default-wrapper' ).outerHeight(); 1060 ts_height = ts_height + default_header_height; 1061 } 1062 1063 if( $( '.hongo-main-title-wrap' ).length > 0 && $( '.top-space-padding' ).length > 0 ) { 1064 var padding_top = $( '.hongo-main-title-wrap' ).attr( 'data-padding-top' ); 1065 if( padding_top == '' || padding_top == undefined ) { 1066 padding_top = $( '.hongo-main-title-wrap' ).css('padding-top'); 1067 } 1068 ts_height = parseInt( ts_height ) + parseInt( padding_top ); 1069 } 1070 1071 if( $element.length ) { 1072 1073 var windowHeight = ( $( window ).height() ); 1074 1075 if( $element.hasClass( 'top-space' ) || $element.hasClass( 'top-space-padding' ) ) { 1076 windowHeight = windowHeight - ts_height; 1077 } 1078 1079 if( windowHeight ) { 1080 $element.css( "min-height", windowHeight + "px" ); 1081 } 1082 } 1083 }); 1084 1085 /* Overwrite VC full width row */ 1086 $( document ).on( 'vc-full-width-row', function( e ) { 1087 1088 var $elements = $( '[data-vc-full-width="true"]' ); 1089 $.each($elements, function(key, item) { 1090 var $el = $(this); 1091 $el.addClass("vc_hidden"); 1092 var $el_full = $el.next(".vc_row-full-width"); 1093 if ($el_full.length || ($el_full = $el.parent().next(".vc_row-full-width")), $el_full.length) { 1094 var padding, paddingRight, el_margin_left = parseInt($el.css("margin-left"), 10), 1095 el_margin_right = parseInt($el.css("margin-right"), 10), 1096 offset = 0 - $el_full.offset().left - el_margin_left, 1097 width = $(window).width(); 1098 1099 /* Box layout strach row code start */ 1100 if( $( '.box-layout' ).length > 0 ) { 1101 1102 var boxLayoutWidth = $( '.box-layout' ).width(); 1103 var boxWidth = ( width - boxLayoutWidth ) / 2; 1104 1105 offset = offset + boxWidth; 1106 width = width - ( boxWidth * 2 ); 1107 } 1108 /* Box layout strach row code end */ 1109 1110 /* Let menu strach row code start */ 1111 if( $( '.hongo-main-site-content' ).length > 0 ) { 1112 1113 var leftHeaderWidth = $( '.header-left-wrapper' ).width(); 1114 var leftMenuLayoutWidth = $( '.hongo-main-site-content' ).width(); 1115 1116 if( $(window).width() > 991 ) { 1117 1118 offset = offset + leftHeaderWidth; 1119 } 1120 width = leftMenuLayoutWidth; 1121 } 1122 /* Let menu strach row code end */ 1123 1124 if ("rtl" === $el.css("direction") && (offset -= $el_full.width(), offset += width, offset += el_margin_left, offset += el_margin_right), $el.css({ 1125 position: "relative", 1126 left: offset, 1127 "box-sizing": "border-box", 1128 width: width 1129 }), !$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({ 1130 "padding-left": padding + "px", 1131 "padding-right": paddingRight + "px" 1132 }); 1133 $el.attr("data-vc-full-width-init", "true"), $el.removeClass("vc_hidden"), $(document).trigger("vc-full-width-row-single", { 1134 el: $el, 1135 offset: offset, 1136 marginLeft: el_margin_left, 1137 marginRight: el_margin_right, 1138 elFull: $el_full, 1139 width: width 1140 }); 1141 } 1142 }); 1143 }); 1144 1145})( 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.