1jQuery(document).ready(function ($) { 2 "use strict"; 3 4 /* Lazy Loading */ 5 //if( typeof lazy === 'function' ) { 6 $(window).on( 'load', function (){ 7 $('.lazy').Lazy({ 8 effect: "fadeIn", 9 effectTime: 500, 10 threshold: 1500 11 }); 12 }); 13 //} 14 15 16 /* Mobile Classic - Navigation Render */ 17 if( $('.sh-header-right-side .sh-nav-mobile').length ) { 18 $('.primary-mobile .sh-nav-mobile').html( $('.sh-header-right-side .sh-nav-mobile').html() ); 19 } else if( $('.sh-header-left-side .sh-nav').length ) { 20 $('.primary-mobile .sh-nav-mobile').html( $('.sh-header-left-side .sh-nav').html() ); 21 } else { 22 $('.primary-mobile .sh-nav-mobile').html( $('.primary-desktop #header-navigation .sh-nav').html() ); 23 } 24 $('.primary-mobile .sh-nav-mobile > li.sh-nav-special').remove(); 25 26 27 /* Header Builder - Mobile Navigation Render */ 28 if( $('.sh-header-builder').length ) { 29 $('.sh-header-builder').each( function() { 30 var nav_html = ''; 31 $(this).find( '.sh-header-builder-main-element-navigation .sh-nav' ).each( function() { 32 nav_html = nav_html + $(this).html(); 33 }); 34 35 $(this).find('.sh-nav-mobile').html( nav_html ); 36 37 }); 38 } 39 40 $('.sh-header-builder-mobile-menu').on('click', function(e) { 41 /*$(this).closest('.sh-header-builder-mobile').find('.sh-header-mobile-dropdown').toggle();*/ 42 43 $(this).closest('.sh-header-builder-mobile').find('.sh-header-mobile-dropdown').stop(true, true).slideToggle( 300, 'linear' ); 44 45 var menu = $(this).find(".c-hamburger"); 46 if( menu.hasClass("is-active") === true ) { 47 menu.removeClass("is-active"); 48 } else { 49 menu.addClass("is-active"); 50 } 51 }); 52 53 54 /* Mobile header dropdown (close if needed) */ 55 setTimeout(function(){ 56 if( $(document).width() < 1025 ) { 57 $('.primary-desktop .sh-nav ul.sub-menu, .sh-header-builder-main ul.sub-menu').css('display', 'none'); 58 } 59 }, 50); 60 function jevelin_header_dropdown() { 61 if ($(document).width() > 1025) { 62 $('.sh-header-mobile-dropdown').hide(); 63 } 64 65 if ($(document).width() < 1025) { 66 $('body').removeClass('page-layout-right-fixed'); 67 $('.primary-desktop ul.sub-menu, .sh-header-builder-main ul.sub-menu').css( 'display', 'none' ); 68 $('.sh-sticky-mobile-header .sh-header-mobile-dropdown').css( 'overflow', 'auto' ); 69 if( $('#wpadminbar').length ) { 70 $('.sh-sticky-mobile-header .sh-header-mobile-dropdown').css( 'max-height', $(window).height() - $('.sh-header-mobile-navigation').height() - $('#wpadminbar').height() ); 71 } else { 72 $('.sh-sticky-mobile-header .sh-header-mobile-dropdown').css( 'max-height', $(window).height() - $('.sh-header-mobile-navigation').height() ); 73 } 74 } 75 } 76 jevelin_header_dropdown(); 77 78 79 /* Header navigation position fix */ 80 function jevelin_navigation_position() { 81 var new_position, menu_status, menu_width, menu_offset, window_width; 82 window_width = $(document).width(); 83 $('ul.sh-nav ul').mouseover(function() { 84 85 menu_status = $(this).find('.sub-menu').length; 86 if( menu_status > 0 ) { 87 88 menu_width = $(this).find('.sub-menu').actual( 'outerWidth' ); 89 //console.log( menu_width ); 90 menu_offset = $(this).find('.sub-menu').parent().offset().left + menu_width; 91 if( (menu_offset + menu_width) > window_width ) { 92 93 if( $('.sh-header.sh-header-megamenu-style2').length ) { 94 new_position = menu_width + 0 + 15; 95 } else { 96 new_position = menu_width + 0; 97 } 98 99 $(this).find('.sub-menu').css({ 100 left: -new_position-0, 101 top: '0', 102 }); 103 104 } else { 105 106 $(this).find('.sub-menu').css({ 107 left: new_position+0, 108 top: '0', 109 }); 110 111 } 112 113 } 114 }); 115 } 116 jevelin_navigation_position(); 117 118 119 /* Mega menu helper */ 120 function jevelin_megamenu() { 121 $('.sh-nav .mega-menu-row').each(function(){ 122 $(this).children().css('height',''); 123 var self = $(this); 124 var count = parseInt( $(this).children().length ); 125 if( count > 0 && count <= 4 ) { 126 $(this).addClass( 'mega-menu-row-'+count ); 127 128 var maxHeight = $(self).actual( 'height' ); 129 $(this).find('>:nth-child(-n+'+count+')').each(function() { 130 $(this).height( maxHeight ); 131 }); 132 } else { 133 $(this).addClass( 'mega-menu-row-5' ); 134 135 var count_now = 0; 136 while( count >= count_now ) { 137 count_now += 4; 138 139 var maxHeight = -1; 140 $(this).find('>:nth-child(n+'+(count_now-3)+'):nth-child(-n+'+count_now+')').each(function() { 141 maxHeight = maxHeight > $(this).actual( 'height' ) ? maxHeight : $(this).actual( 'height' ); 142 }); 143 144 $(this).find('>:nth-child(n+'+(count_now-3)+'):nth-child(-n+'+count_now+')').each(function() { 145 $(this).height(maxHeight); 146 }); 147 } 148 } 149 }); 150 } 151 jevelin_megamenu(); 152 153 154 /* Page builder section option */ 155 $('.sh-column-adjust-left .fw-row:first-child .sh-column:first-child > div').append( '<div class="fw-row">'+$('.sh-section-3e0cbbb965eff9a43388283e981cfa23 .fw-row:not(:first-child)').html()+'</div>' ); 156 $('.sh-column-adjust-left .sh-section-container > .fw-row:not(:first-child)').remove(); 157 158 var section_justify_height_init = 1; 159 var section_justify_height_last = 0; 160 if( $('.sh-google-map').length > 0 ) { 161 section_justify_height_init = 0; 162 } 163 function jevelin_section_justify_height() { 164 $( '.section-justify-height .fw-row' ).each(function() { 165 if( $(this).children().length > 1 ) { 166 167 $(this).children().css( 'height', '' ); 168 $('.section-justify-height-google-maps').css( 'max-height', '' ).css( 'min-height', '' ); 169 if (window.matchMedia('(min-width: 800px)').matches) { 170 $(this).children().css( 'height', $(this).height() ); 171 section_justify_height_last = $(this).height(); 172 173 $(this).find('.section-justify-height-google-maps').css( 'max-height', section_justify_height_last+'px' ).css( 'min-height', section_justify_height_last+'px' ); 174 } 175 176 if( section_justify_height_init < 1 ) { 177 $(this).children().children().each(function() { 178 if( $(this).children().length == '1' && $(this).children().hasClass('sh-google-map') == true ) { 179 $(this).find('.fw-map > .fw-map-canvas').addClass('section-justify-height-google-maps').css( 'max-height', section_justify_height_last+'px' ).css( 'min-height', section_justify_height_last+'px' ); 180 } 181 }); 182 } 183 184 } 185 186 }); 187 section_justify_height_init++; 188 } 189 190 jevelin_section_justify_height(); 191 $(window).load(function (){ 192 jevelin_section_justify_height(); 193 });
194 195 196 /* Header Height */ 197 $('.sh-header-7 #header-logo').css('height',$('.sh-header-7').height()); 198 $('.sh-header-top-10 .header-contacts').css('height',$('.sh-header-top-10').height()); 199 $('header.primary-desktop').css('height', $('header.primary-desktop').actual( 'height' ) ); 200 $('header.primary-mobile').css('height', $('.sh-header-mobile-navigation').actual( 'height' ) + $('header.primary-mobile .sh-page-notice').actual( 'outerHeight' ) ); 201 202 203 /* Resize action (slow) */ 204 $(window).resize(function() { 205 clearTimeout(window.resizedFinished); 206 window.resizedFinished = setTimeout(function(){ 207 208 jevelin_header_dropdown(); 209 jevelin_navigation_position(); 210 jevelin_megamenu(); 211 jevelin_section_justify_height(); 212 213 }, 500); 214 }); 215 216 217 /* Resize action (fast) */ 218 var primary_desktop = '' 219 $(window).on( 'load resize', function() { 220 if( $(document).width() > 1025 ) { 221 $('header.primary-desktop').css('height',''); 222 primary_desktop = $('.sh-header').actual( 'outerHeight') + $('.sh-header-top').actual( 'outerHeight'); 223 $('header.primary-desktop').css('height', primary_desktop ); 224 } 225 }); 226 227 228 /* Header Builder - Search */ 229 $(".sh-header-builder-search-trigger").on( 'click', function(e) { 230 $(this).closest( '.sh-header-builder' ).find( '.sh-header-search' ).fadeIn("fast"); 231 $(this).closest( '.sh-header-builder' ).find( '.sh-header-search-input' ).focus(); 232 e.preventDefault(); 233 return false; 234 }); 235 236 $(".sh-header-builder-main .close-header-search").on( 'click', function(e) { 237 $(this).closest( '.sh-header-search' ).fadeOut("fast"); 238 e.preventDefault(); 239 return false; 240 }); 241 242 243 /* Header Classic - Search */ 244 $(".sh-nav-search, .sh-side-button-search").on( 'click', function() { 245 if( $("#primary-desktop").actual( 'height' ) > 200 ) { 246 $("#header-search").addClass( 'sh-side-button-search-line' ); 247 } 248 249 $("#header-search").fadeIn("fast"); 250 $("#header-search").find(".sh-header-search-input").focus(); 251 return false; 252 }); 253 $(".close-header-search").on( 'click', function() { 254 $("#header-search").fadeOut("fast"); 255 return false; 256 }); 257 $( ".sh-header-search-form" ).submit(function( event ) { 258 $(this).fadeTo( "fast", 0.45 ); 259 }); 260 261 $(document).keyup(function(e) { 262 if (e.keyCode == 27) { 263 $(".sh-header-search").fadeOut("fast"); 264 265 if( $('body').hasClass('page-layout-right-fixed') ) { 266 $("body").removeClass('page-layout-right-fixed'); 267 268 var menu = $(".sh-header .sh-nav-dropdown").find(".c-hamburger"); 269 if( e.target != 'div.sh-table-cell' ) { 270 if( menu.hasClass("is-active") === true ) { 271 menu.removeClass("is-active"); 272 } else { 273 menu.addClass("is-active"); 274 } 275 } 276 } 277 } 278 }); 279 280 281 /* Header side menu */ 282 $(".sh-header .sh-nav-dropdown").on( 'click', function(e) { 283 var self = $(this); 284 285 if( !$("body").hasClass('page-layout-right-fixed') ) { 286 287 $(".sh-header").addClass("sh-animation-left"); 288 $("body").addClass('page-layout-right-fixed'); 289 setTimeout(function(){ 290 $(".sh-header").removeClass("sh-animation-left"); 291 }, 301); 292 293 } else { 294 295 $(".sh-header").addClass("sh-animation-left"); 296 $("body").removeClass('page-layout-right-fixed'); 297 setTimeout(function(){ 298 $(".sh-header").removeClass("sh-animation-left"); 299 jQuery(window).trigger('resize'); 300 }, 301); 301 302 setTimeout(function(){ 303 jQuery(window).trigger('resize'); 304 }, 350); 305 306 setTimeout(function(){ 307 jQuery(window).trigger('resize'); 308 }, 450); 309 } 310 311 var menu = self.find(".c-hamburger"); 312 if( e.target != 'div.sh-table-cell' ) { 313 if( menu.hasClass("is-active") === true ) { 314 menu.removeClass("is-active"); 315 } else { 316 menu.addClass("is-active"); 317 } 318 } 319 320 var self_icon_image = self.find('.sh-nav-custom-icon-image'); 321 if( self_icon_image.hasClass( 'active' ) ) { 322 self_icon_image.removeClass( 'active' ); 323 } else { 324 self_icon_image.addClass( 'active' ); 325 } 326 327 return false; 328 });
329 330 331 /* Mobile header dropdown folders */ 332 $('.sh-header-mobile-dropdown ul li:has(">ul") a').on( 'click', function() { 333 $(this).parent().toggleClass('open'); 334 $(this).parent().find('> ul').stop(true, true).slideToggle(300, 'easeOutQuint'); 335 if( $(this).parent().hasClass('open') ) { 336 $(this).parent().find('ul ul').stop(true, true).slideUp(0, 'easeOutQuint'); 337 } 338 339 if( $(this).parent().hasClass('menu-item-has-children') ) { 340 return false; 341 } 342 }); 343 $('html').on( 'click', function(e) { 344 if( !$(e.target).hasClass('header-mobile-form-input') && $('.sh-header-mobile-dropdown').is(':visible') ) { 345 $('.sh-nav-dropdown .c-hamburger').trigger('click').toggleClass('is-active'); 346 } 347 }); 348 /*$('.sh-header-mobile-dropdown').click(function(event){ 349 event.stopPropagation(); 350 });*/ 351 352 353 /* Close mobile dropdown on click */ 354 $('.sh-header-mobile-dropdown li.menu-item:not(.menu-item-has-children)').on( 'click', function() { 355 if( $(this).find('> a').attr('href').indexOf("#") >= 0 ) { 356 setTimeout(function(){ 357 if( $('.sh-header-mobile .sh-nav-dropdown .c-hamburger').hasClass( 'is-active' ) ) { 358 $('.sh-header-mobile .sh-nav-dropdown .c-hamburger').trigger('click').toggleClass('is-active'); 359 } 360 }, 50); 361 } 362 }); 363 364 365 /* Popover */ 366 $('.sh-popover-mini').addClass('sh-animated fadeIn'); 367 368 369 /* Image Compare */ 370 $(window).load(function (){ 371 $('.sh-image-comparison .twentytwenty-handle').addClass('sh-animated pulse'); 372 $('.sh-image-comparison .twentytwenty-before').addClass('sh-animated fadeIn'); 373 $('.sh-image-comparison .twentytwenty-handle').on('mouseover', function() { 374 $(this).addClass('sh-stop-animation'); 375 }); 376 }); 377 378 379 /* Animations */ 380 if( ( typeof( WOW ) == typeof( Function) ) ) { 381 var wow = new WOW({ 382 boxClass: 'sh-animated', 383 animateClass: 'animated', 384 offset: 100, 385 mobile: true, 386 live: true, 387 scrollContainer: null 388 }); 389 wow.init(); 390 } 391 392 393 /* Blog masonry layout */ 394 $('.blog-style-masonry:not(.sh-recent-posts-list-carousel)').each( function() { 395 var $masonry = $(this).isotope({ 396 itemSelector: '.post-item', 397 columnWidth: 0, 398 gutter: 0, 399 }).isotope('reloadItems'); 400 $masonry.imagesLoaded( function() { 401 $masonry.isotope('layout').css( 'opacity', 1 ); 402 }); 403 $(window).load(function (){ 404 setTimeout(function(){ 405 $masonry.isotope('layout'); 406 }, 0); 407 }); 408 }); 409 410 411 /* Portfolio masonry layout */ 412 $('.sh-portfolio').each( function() { 413 var portfolio_filter = '*'; 414 if( $(this).attr( 'data-all-filter' ) ) { 415 portfolio_filter = $(this).attr( 'data-all-filter' ); 416 } 417 var $portfolio = $(this).isotope({ 418 itemSelector: '.sh-portfolio-item', 419 columnWidth: 0, 420 gutter: 0, 421 filter: portfolio_filter 422 }).isotope('reloadItems').css( 'opacity', 1 ); 423 424 $(window).load(function (){ 425 $portfolio.imagesLoaded( function() { 426 $portfolio.isotope('layout'); 427 }); 428 }); 429 }); 430 431 432 433 /* Portfolio filter */ 434 $('.sh-filter:not(.sh-filter-pagination)').on( 'click', 'span', function() { 435 436 var filterValue = $(this).attr('data-filter'); 437 if( $(this).parent().attr('data-type') != 'woocommerce' ) { 438 $(this).parent().parent().parent().find('.sh-portfolio').isotope({ filter: filterValue }); 439 } else { 440 $(this).parent().parent().parent().find('ul.products').isotope({ filter: filterValue }); 441 } 442 443 $(this).parent().children().removeClass('active'); 444 $(this).addClass('active'); 445 446 }); 447 448 449 /* Portfolio fancy filter */ 450 $('.sh-filter:not(.sh-filter-pagination)').on( 'click', 'span', function() { 451 452 var filterValue = $(this).attr('data-filter'); 453 $(this).parent().parent().parent().find('.sh-portfolio-fancy .sh-portfolio-fancy-item').each( function() { 454 $(this).removeClass('sh-portfolio-fancy-item-active').addClass('sh-portfolio-fancy-item-active-cat'); 455 }); 456 $(this).parent().parent().parent().find('.sh-portfolio-fancy').isotope({ filter: filterValue });
457 458 $(this).parent().children().removeClass('active'); 459 $(this).addClass('active'); 460 461 }); 462 463 464 /* Portfolio filter with enabled pagination */ 465 $('.sh-filter.sh-filter-pagination').on( 'click', 'span', function() { 466 window.location.href = $(this).attr('data-href'); 467 $(this).parent().children().removeClass('active'); 468 $(this).addClass('active'); 469 }); 470 471 472 /* Portfolio fancy masonry layout */ 473 $.fn.isVisible = function() { 474 var rect = this[0].getBoundingClientRect(); 475 //console.log( rect ); 476 return ( 477 (rect.height > 0 || rect.width > 0) && 478 rect.bottom >= 0 && 479 rect.right >= 0 && 480 rect.top <= (window.innerHeight || document.documentElement.clientHeight) && 481 rect.left <= (window.innerWidth || document.documentElement.clientWidth) 482 ); 483 }; 484 $.fn.isVisibleAbove = function() { 485 var rect = this[0].getBoundingClientRect(); 486 //console.log( rect ); 487 return ( 488 (rect.height > 0 || rect.width > 0) && 489 rect.bottom < 0 && 490 rect.right >= 0 && 491 rect.top < 0 && 492 rect.left <= (window.innerWidth || document.documentElement.clientWidth) 493 ); 494 }; 495 $.fn.portfolioFancy = function(){ }; 496 497 var $portfolio2 = $('.sh-portfolio-fancy').isotope({ 498 itemSelector: '.sh-portfolio-fancy-item', 499 columnWidth: 0, 500 gutter: 0, 501 }).isotope('reloadItems'); 502 503 $(window).load(function (){ 504 $portfolio2.imagesLoaded( function() { 505 var time = 0; 506 $('.sh-portfolio-fancy').find('.sh-portfolio-fancy-item').each( function() { 507 508 var self = $(this); 509 if( self.isVisible() ) { 510 setTimeout( function(){ 511 self.addClass( 'sh-portfolio-fancy-item-active' ); 512 }, time); 513 time += 300; 514 } else if( self.isVisibleAbove() ) { 515 self.addClass( 'sh-portfolio-fancy-item-active' ); 516 } 517 518 }); 519 $portfolio2.isotope('layout'); 520 }); 521 522 $(window).scroll(function() { 523 clearTimeout(window.scrollFinished); 524 window.scrollFinished = setTimeout(function(){ 525 526 var time2 = 0; 527 $('.sh-portfolio-fancy').find('.sh-portfolio-fancy-item:not(.sh-portfolio-fancy-item-active)').each( function() { 528 var self = $(this); 529 if( self.isVisible() ) { 530 setTimeout( function(){ 531 self.addClass( 'sh-portfolio-fancy-item-active' ); 532 }, time2); 533 time2 += 300; 534 } 535 }); 536 537 }, 100); 538 }); 539 }); 540 541 542 /* Onepage navigation */ 543 if( jevelin.one_pager == true ) { 544 545 /* Onepage navigation - On load */ 546 if( window.location.href && window.location.href.split("#")[1] ) { 547 var topbar = 0; 548 if ($(document).width() > 1000 && $(".sh-header").hasClass('sh-sticky-header-active') ) { 549 topbar = topbar + parseInt( $('.sh-header').height() ); 550 } else if ($(document).width() > 1000 && $(".sh-header").hasClass('sh-sticky-header') ) { 551 topbar = topbar + parseInt( $('.sh-header').height() ) - 30; 552 } 553 554 if( $(document).width() > 600 && $('#wpadminbar').height() > 0 ) { 555 topbar = topbar + $('#wpadminbar').height(); 556 } 557 558 $(window).load(function (){ 559 if( $('#'+window.location.href.split("#")[1]).length && !$('#'+window.location.href.split("#")[1]).hasClass('vc_tta-panel') ) { 560 $('html, body').animate({ 561 scrollTop: ( $('#'+window.location.href.split("#")[1]).offset().top - topbar ) 562 }, 1000); 563 } 564 }); 565 } 566 567 568 /* Close mobile menu, when clicking internal links */ 569 $('nav.sh-header-mobile-dropdown li.menu-item > a[href*="#"]').on("click", function (e){
570 $('.sh-header-builder-mobile-menu').trigger('click'); 571 }) 572 573 574 /* Onepage navigation - On click custom actions */ 575 $('a[href^="#goto-"], a[href^="#backtotop"], a[href$="#backtotop"]').on("click", function (e){ 576 577 if( $(this).attr('href').indexOf( '#backtotop' ) == -1 ) { 578 579 var url = $(this).attr('href'); 580 if (url.indexOf("goto-") !=-1) { 581 url = url.replace("goto-", ""); 582 } 583 584 if( url && url.substring(0,1) == '#' ) { 585 e.preventDefault(); 586 if( $(url).length ) { 587 588 var topbar = 0; 589 if ($(document).width() > 1000 && $(".sh-header").hasClass('sh-sticky-header-active') ) { 590 topbar = topbar + $('.sh-header').height(); 591 } 592 593 if( $(document).width() > 600 && $('#wpadminbar').height() > 0 ) { 594 topbar = topbar + $('#wpadminbar').height(); 595 } 596 597 $('html, body').animate({ 598 scrollTop: ( $(url).offset().top - topbar ) 599 }, 1000); 600 601 } 602 } 603 604 } else { 605 606 // set hash 607 if( history.pushState ) { 608 history.pushState( null, null, '#backtotop' ); 609 } else { 610 location.hash = '#backtotop'; 611 } 612 613 // scroll to 614 $('html, body').animate({ 615 scrollTop: 0 616 }, 1000); 617 618 } 619 }); 620 621 622 /* Onepage navigation - On click */ 623 $('a[href*="#"]:not([data-vc-tabs]):not([data-vc-accordion]):not(.vc_carousel-control)').on('click', function(e) { 624 var hash_url = $(this).attr('href'); 625 var hash_val = hash_url.substring(hash_url.indexOf('#')); 626 var hash_full_url = $(this).attr('href').split("#")[0]; 627 hash_full_url = hash_full_url.replace( 'http:', '' ); 628 hash_full_url = hash_full_url.replace( 'https:', '' ); 629 630 var current_hash_full_url = window.location.href.split("#")[0]; 631 current_hash_full_url = current_hash_full_url.replace( 'http:', '' ); 632 current_hash_full_url = current_hash_full_url.replace( 'https:', '' ); 633 634 635 // redirect if not the same page 636 if( hash_full_url && hash_full_url != current_hash_full_url ) { 637 window.location.href = $(this).attr('href'); 638 } 639 640 641 // scroll to element 642 if( hash_val && 643 $(hash_val).length && 644 hash_val.indexOf("goto-") < 0 && 645 hash_val.indexOf("backtotop") < 0 && 646 $(this).attr('data-toggle') != 'collapse' && 647 $(this).attr('data-toggle') != 'tab' && 648 !$(this).parent().parent().hasClass('wc-tabs') ) { 649 650 e.preventDefault(); 651 e.stopPropagation(); 652 653 var topbar = 0; 654 if ($(document).width() > 1000 && $(".sh-header").hasClass('sh-sticky-header-active') ) { 655 topbar = topbar + parseInt( $('.sh-header').height() ); 656 } else if ($(document).width() > 1000 && $(".sh-header").hasClass('sh-sticky-header') ) { 657 topbar = topbar + parseInt( $('.sh-header').height() ) - 30; 658 } 659 660 if( $(document).width() > 600 && $('#wpadminbar').height() > 0 ) { 661 topbar = topbar + $('#wpadminbar').height(); 662 } 663 664 // set hash 665 if( history.pushState ) { 666 history.pushState(null, null, hash_val); 667 } else { 668 location.hash = hash_val; 669 } 670 671 // scroll to 672 $('html, body').animate({ 673 scrollTop: ( $(hash_val).offset().top - topbar ) 674 }, 1000); 675 } 676 });
677 } 678 679 680 /* Header Builder - Content Above */ 681 var headers_above_content = 0; 682 $('.sh-header-builder').each( function() { 683 if( $(this).hasClass( 'sh-header-builder-main-above-content' ) ) { 684 if( headers_above_content > 0 ) { 685 var self = $(this); 686 setTimeout(function(){ 687 self.removeClass( 'sh-header-builder-main-above-content' ); 688 }, 10); 689 } 690 691 headers_above_content++; 692 } 693 }); 694 695 696 /* Header Builder - Sticky */ 697 function heade_builder_sticky() { 698 if( $(document).width() >= 1025 ) { 699 700 if( $('#wpadminbar').length ) { 701 var header_builder_admin = $('#wpadminbar').actual( 'height' ); 702 } else { 703 var header_builder_admin = 0; 704 } 705 $('.sh-header-builder-main-sticky-enabled').first().height( $('.sh-header-builder-main-sticky-enabled').first().actual('height') ); 706 707 var header_builder_sticky = $('.sh-header-builder-main-sticky-enabled').first(); 708 if( $(window).scrollTop() && $(window).scrollTop() > header_builder_sticky.offset().top - header_builder_admin ) { 709 if( !header_builder_sticky.hasClass( 'sh-header-builder-main-sticky-fixed' ) ) { 710 header_builder_sticky.addClass('sh-header-builder-main-sticky-fixed').find('.sh-header-builder-main-container').css( 'top', header_builder_admin ); 711 } 712 } else { 713 header_builder_sticky.removeClass('sh-header-builder-main-sticky-fixed').find('.sh-header-builder-main-container').css( 'top', '' ); 714 } 715 716 } 717 } 718 719 if( $('.sh-header-builder-main-sticky-enabled').length ) { 720 heade_builder_sticky(); 721 $(window).scroll( heade_builder_sticky ); 722 } 723 724 725 /* Header Builder - Mobile Sticky */ 726 function heade_builder_mobile_sticky() { 727 if( $(document).width() < 1025 ) { 728 729 if( $('#wpadminbar').length ) { 730 var header_builder_admin = $('#wpadminbar').actual( 'height' ); 731 } else { 732 var header_builder_admin = 0; 733 } 734 735 var header_builder_sticky = $('.sh-header-builder-mobile-sticky-enabled').first(); 736 737 if( $(window).scrollTop() && $(window).scrollTop() > 1 ) { 738 if( !header_builder_sticky.hasClass('sh-sticky-mobile-header') ) { 739 $('.sh-header-builder-mobile-sticky-enabled').first().height( $('.sh-header-builder-mobile-sticky-enabled').first().actual('height') ); 740 header_builder_sticky.addClass('sh-header-builder-mobile-sticky-fixed').addClass('sh-sticky-mobile-header'); 741 /*alert( 'CHANGE:' + $(window).scrollTop() + ' // ' + ( header_builder_sticky.offset().top - header_builder_admin ) );*/ 742 } 743 } else { 744 header_builder_sticky.removeClass('sh-header-builder-mobile-sticky-fixed').removeClass('sh-sticky-mobile-header'); 745 } 746 747 // console.log( $(window).scrollTop() + ' // ' + ( header_builder_sticky.offset().top - header_builder_admin ) ); 748 749 } 750 } 751 752 if( $('.sh-header-builder-mobile-sticky-enabled').length ) { 753 heade_builder_mobile_sticky(); 754 $(window).scroll( heade_builder_mobile_sticky ); 755 } 756 757 758 759 760 /* Header Classic - Sticky */ 761 function jevelin_sticky(){ 762 if ($(document).width() > 1025) { 763 764 if( header_height < 0 ) { 765 header_height = $('.sh-header').actual( 'height' ); 766 } 767 768 if( header_offset_total < 0 ) { 769 if( $('#wpadminbar').length ) { 770 var header_admin = $('#wpadminbar').actual( 'height' ); 771 } else { 772 var header_admin = 0; 773 } 774 775 if( $('.sh-header').length ) { 776 var header_offset = $('.sh-header').offset().top - header_admin; 777 } else { 778 var header_offset = 0; 779 } 780 header_offset_total = header_offset; 781 } 782 783 if( $(document).scrollTop() > header_offset_total ){ 784 if( !$('body').hasClass('compose-mode') ) { 785 $('.sh-header').addClass('sh-sticky-header-active').css('top', $('#wpadminbar').actual( 'height' )); 786 } else { 787 $('.sh-header').addClass('sh-sticky-header-active').css('top', 0); 788 } 789 } else { 790 if( primary_desktop > 0 ) { 791 $('.sh-header-height').css( 'height', primary_desktop ); 792 $('.sh-header:not(.sh-header-2):not(.sh-header-3):not(.sh-header-4)').css( 'height', primary_desktop ); 793 794 setTimeout(function(){ 795 $('.sh-header-height').css( 'height', '' ); 796 $('.sh-header:not(.sh-header-2):not(.sh-header-3):not(.sh-header-4)').css( 'height', '' ); 797 }, 300); 798 } 799 800 $('.sh-header').removeClass('sh-sticky-header-active').css('top', 0); 801 } 802 } 803 804 if($(document).scrollTop() > 0 ){ 805 $('.sh-header-mobile').addClass('sh-sticky-mobile-header-active'); 806 } else { 807 $('.sh-header-mobile').removeClass('sh-sticky-mobile-header-active'); 808 } 809 } 810 811 if( $('.sh-sticky-header').length ) { 812 813 if( $('#wpadminbar').length ) { 814 var header_admin = $('#wpadminbar').height(); 815 } else { 816 var header_admin = 0; 817 } 818 819 if( $('.sh-header').length ) { 820 var header_offset = $('.sh-header').offset().top - header_admin; 821 } else { 822 var header_offset = 0; 823 } 824 825 var header_height = $('.sh-header').height(); 826 var header_offset_total = header_offset; 827 var header_offset_sticky = 0; 828 829 jevelin_sticky(); 830 $(window).scroll(jevelin_sticky); 831 } 832 $(window).on( 'ready load', function() { 833 if( $('body').hasClass('compose-mode') ) { 834 $('.sh-header').removeClass('sh-sticky-header-active').css('top', 0); 835 } 836 });
837 838 839 /* Footer copyrights */ 840 if( $('.sh-copyrights-image').height() > 0 ) { 841 $('.sh-copyrights-text, .sh-copyrights-social').css('line-height', $('.sh-copyrights-image').height()+'px'); 842 } 843 844 845 /* Alert Message - Close */ 846 $('.sh-alert-close').on('click', function() { 847 $(this).parent().fadeTo(400, 0.00, function(){ //fade 848 $(this).slideUp(400, function() { //slide up 849 $(this).remove(); //then remove from the DOM 850 }); 851 }); 852 }); 853 854 855 /* Counter SC */ 856 if(jQuery().counterUp) { 857 $('.sh-counter-animate').counterUp({ 858 delay: 14, 859 time: 1500, 860 triggerOnce: true 861 }); 862 } 863 864 865 /* Share */ 866 $(".sh-social-share-networks").jsSocials({ 867 showLabel: false, 868 showCount: "inside", 869 shares: ["facebook", "twitter", "email", "pinterest"], 870 shareIn: "blank", 871 }); 872 873 874 /* Blog, Portfolio Gallery */ 875 $('.sh-gallery:not(.sh-gallery-autoplay)').slick({ 876 accessibility: true, 877 dots: true, 878 arrows: true, 879 infinite: true, 880 speed: 300, 881 slidesToShow: 1, 882 adaptiveHeight: true, 883 prevArrow: '<button type="button" class="slick-prev"><span class="ti-angle-left"></span></button>', 884 nextArrow: '<button type="button" class="slick-next"><span class="ti-angle-right"></span></button>', 885 }); 886 887 888 /* Blog, Portfolio Gallery Autoplay */ 889 $('.sh-gallery-autoplay').slick({ 890 accessibility: true, 891 dots: true, 892 arrows: true, 893 infinite: true, 894 speed: 300, 895 slidesToShow: 1, 896 autoplay: true, 897 autoplaySpeed: 5000, 898 adaptiveHeight: true, 899 prevArrow: '<button type="button" class="slick-prev"><span class="ti-angle-left"></span></button>', 900 nextArrow: '<button type="button" class="slick-next"><span class="ti-angle-right"></span></button>', 901 }); 902 903 904 /* Sidebar Search */ 905 $('.sh-sidebar-search').blur(function() { 906 $(this).parent().parent().parent().removeClass("sh-sidebar-search-active"); 907 }) 908 .focus(function() { 909 $(this).parent().parent().parent().addClass("sh-sidebar-search-active") 910 }); 911 912 913 /* Quantity buttons */ 914 function sh_increase_number_update() { 915 if( $('body').hasClass('woocommerce-cart') ) { 916 $('input[name="update_cart"]').removeAttr('disabled'); 917 918 setTimeout(function(){ 919 }, 500); 920 921 } 922 } 923 924 if( jevelin.quantity_button != 'off' ) { 925 $('.quantity').each( function() { 926 if( $(this).children().is( 'input' ) ) { 927 928 $(this).children().attr( 'type', 'text' ); 929 $(this).children().attr( 'class', 'sh-quantity-number' ); 930 $(this).prepend( '<span class="sh-noselect sh-increase-number-down"><i class="ti-arrow-down"></i></span>' ); 931 $(this).append( '<span class="sh-noselect sh-increase-number-up"><i class="ti-arrow-up"></i></span>' ); 932 $(this).addClass( 'sh-increase-numbers' ); 933 934 } 935 }); 936 937 $("input.sh-quantity-number").on('keyup keypress blur change', function(e) { 938 if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { 939 return false; 940 }else{ 941 if( $(this).val().length >= parseInt($(this).attr('maxlength')) && (e.which != 8 && e.which != 0)){ 942 return false; 943 } 944 } 945 }); 946 947 $('body').on( 'updated_cart_totals', function(){ 948 if( $('.woocommerce .sh-alert-error').length > 1 ) { 949 $('.woocommerce .sh-alert-error').first().remove(); 950 } 951 952 $('.quantity').each( function() { 953 if( $(this).children().is( 'input' ) ) { 954 $(this).find('.sh-increase-number-down').remove(); 955 $(this).find('.sh-increase-number-up').remove(); 956 957 $(this).children().attr( 'type', 'text' ); 958 $(this).children().attr( 'class', 'sh-quantity-number' ); 959 $(this).prepend( '<span class="sh-noselect sh-increase-number-down"><i class="ti-arrow-down"></i></span>' ); 960 $(this).append( '<span class="sh-noselect sh-increase-number-up"><i class="ti-arrow-up"></i></span>' ); 961 $(this).addClass( 'sh-increase-numbers' ); 962 963 } 964 }); 965 }); 966 967 968 var gillion_product_increase_number_min = ( $('.woocommerce-grouped-product-list.group_table').length ) ? 0 : 1; 969 $(document).on('click', '.sh-increase-number-down', function(){ 970 var current_number_val = parseInt( $(this).parent().find('input.sh-quantity-number').val() ); 971 var current_number = isNaN( current_number_val ) ? 0 : current_number_val; 972 current_number = current_number - 1; 973 974 if( current_number >= gillion_product_increase_number_min ) { 975 $(this).parent().find('input.sh-quantity-number').val( current_number ); 976 sh_increase_number_update(); 977 } 978 }); 979 980 $(document).on('click', '.sh-increase-number-up', function(){ 981 var current_number_val = parseInt( $(this).parent().find('input.sh-quantity-number').val() ); 982 var current_number = isNaN( current_number_val ) ? 0 : current_number_val; 983 current_number = current_number + 1; 984 985 if( current_number >= 0 ) { 986 $(this).parent().find('input.sh-quantity-number').val( current_number ); 987 sh_increase_number_update(); 988 } 989 }); 990 } else { 991 $('.woocommerce .quantity').addClass( 'quantity-basic' ); 992 } 993 994 995 /* Back To Top */ 996 if ($('.sh-back-to-top').length) { 997 var scrollTrigger = 100, // px 998 backToTop = function () { 999 var scrollTop = $(window).scrollTop(); 1000 if (scrollTop > scrollTrigger) { 1001 $('.sh-back-to-top').addClass('active'); 1002 } else { 1003 $('.sh-back-to-top').removeClass('active'); 1004 } 1005 }; 1006 backToTop(); 1007 $(window).on('scroll', function () { 1008 backToTop(); 1009 }); 1010 1011 $('.sh-back-to-top').on('click', function (e) { 1012 e.preventDefault(); 1013 $(this).blur(); 1014 $('html,body').animate({ 1015 scrollTop: 0 1016 }, 500); 1017 }); 1018 } 1019 1020 1021 /* Hamburger Animation */ 1022 var toggles = document.querySelectorAll(".sh-header-mobile-navigation .c-hamburger"); 1023 for (var i = toggles.length - 1; i >= 0; i--) { 1024 var toggle = toggles[i]; 1025 toggleHandler(toggle); 1026 }; 1027 function toggleHandler(toggle) { 1028 toggle.addEventListener( "click", function(e) { 1029 e.preventDefault(); 1030 (this.classList.contains("is-active") === true) ? this.classList.remove("is-active") : this.classList.add("is-active"); 1031 }); 1032 } 1033 1034 1035 /* Left header fix */ 1036 if( $('.sh-header-left-side').length ) { 1037 $('.sh-header-left-side .sh-nav-cart .sub-menu').css( 'to
1037p', -parseInt( $('.sh-header-left-side .sh-nav-cart .sub-menu').height()) ); 1038 $(window).on( 'load resize', function() { 1039 var side_logo_spacing = ( $('#wpadminbar').length ) ? 100 : 68; 1040 $(".sh-header-left-side #header-logo img").css('max-height', parseInt( $(".sh-header-left-side .header-standard-position").position().top ) - side_logo_spacing ); 1041 $('.sh-header-left-side #header-logo').animate( { opacity: 1 }, 150 ); 1042 }); 1043 } 1044 1045 1046 /* Progress bar */ 1047 if( ( typeof( WOW ) == typeof( Function) ) ) { 1048 var wow_progress = new WOW({ 1049 boxClass: 'sh-progress', 1050 animateClass: '', 1051 mobile: true, 1052 live: true, 1053 callback: function(box, test) { 1054 1055 $('#'+box.id).find('.sh-progress-status-value').each( function() { 1056 $(this).animate( 1057 { 1058 width: $(this).attr('data-width')+'%' 1059 }, { 1060 duration: 1300, 1061 easing: 'easeOutExpo', 1062 } 1063 ); 1064 }); 1065 1066 }, 1067 scrollContainer: null 1068 }); 1069 wow_progress.init(); 1070 } 1071 1072 1073 /* Pie chart */ 1074 setTimeout(function(){ 1075 var wow_progress = new WOW({ 1076 boxClass: 'sh-piechart', 1077 animateClass: '', 1078 mobile: true, 1079 live: true, 1080 callback: function(box, test) { 1081 1082 $('#'+box.id).addClass('sh-piechart-animated'); 1083 1084 if( $('#'+box.id).hasClass('sh-piechart-circle') ) { 1085 if( !$('#'+box.id).find('.circle_animation').css('animation') ) { 1086 $('#'+box.id).find('.circle_animation').velocity({ 1087 strokeDashoffset: parseInt( $('#'+box.id).attr('data-id') ) 1088 }, { 1089 duration: 2000, 1090 easing: [ 0.785, 0.135, 0.150, 0.860 ] 1091 }); 1092 } 1093 } else if( $('#'+box.id).hasClass('sh-piechart-rhomb') ) { 1094 if( !$('#'+box.id).find('.rhomb_animation').css('animation') ) { 1095 $('#'+box.id).find('.rhomb_animation').velocity({ 1096 strokeDashoffset: parseInt( $('#'+box.id).attr('data-id') ) 1097 }, { 1098 duration: 2000, 1099 easing: [ 0.785, 0.135, 0.150, 0.860 ] 1100 }); 1101 } 1102 } 1103
1104 $('#'+box.id).find('.sh-piechart-percentage-number').each(function() { 1105 var self = $(this); 1106 var percent_hours = self.text(); 1107 $({numberValue: 0}).animate({numberValue: percent_hours}, { 1108 duration: 2000, 1109 easing: 'easeOutCirc', 1110 progress: function() { 1111 self.text(Math.round(Math.ceil(this.numberValue*100)/100)); 1112 } 1113 }); 1114 }); 1115 1116 }, 1117 scrollContainer: null 1118 }); 1119 wow_progress.init(); 1120 1121 /*$('.sh-piechart').viewportChecker({ 1122 offset: 100, 1123 callbackFunction: function(box, test){ 1124 1125 $('#'+box.context.id).addClass('sh-piechart-animated'); 1126 1127 if( $('#'+box.context.id).hasClass('sh-piechart-circle') ) { 1128 if( !$('#'+box.context.id).find('.circle_animation').css('animation') ) { 1129 $('#'+box.context.id).find('.circle_animation').velocity({ 1130 strokeDashoffset: parseInt( $('#'+box.context.id).attr('data-id') ) 1131 }, { 1132 duration: 2000, 1133 easing: [ 0.785, 0.135, 0.150, 0.860 ] 1134 }); 1135 } 1136 } else if( $('#'+box.context.id).hasClass('sh-piechart-rhomb') ) { 1137 if( !$('#'+box.context.id).find('.rhomb_animation').css('animation') ) { 1138 $('#'+box.context.id).find('.rhomb_animation').velocity({ 1139 strokeDashoffset: parseInt( $('#'+box.context.id).attr('data-id') ) 1140 }, { 1141 duration: 2000, 1142 easing: [ 0.785, 0.135, 0.150, 0.860 ] 1143 }); 1144 } 1145 } 1146
1147 $('#'+box.context.id).find('.sh-piechart-percentage-number').each(function() { 1148 var self = $(this); 1149 var percent_hours = self.text(); 1150 $({numberValue: 0}).animate({numberValue: percent_hours}, { 1151 duration: 2000, 1152 easing: 'easeOutCirc', 1153 progress: function() { 1154 self.text(Math.round(Math.ceil(this.numberValue*100)/100)); 1155 } 1156 }); 1157 }); 1158 } 1159 });*/ 1160 }, 500); 1161 1162 1163 /* WooCommerce Simple Select Init */ 1164 $(".woocommerce select.country_select").SumoSelect({ search: true }); 1165 $(".woocommerce-ordering .orderby").SumoSelect({ search: true }); 1166 $(".contact-form select").SumoSelect(); 1167 $(".wpcf7-select").SumoSelect(); 1168 1169 1170 /* Portfolio Overlay 3 */ 1171 $('.sh-portfolio-item .sh-portfolio-overlay3').hoverdir(); 1172 1173 1174 /* Portfolio Disable*/ 1175 $('.sh-portfolio-single-disabled').on( 'click', function() { 1176 return false; 1177 }); 1178 1179 1180 /* Youtube Visual Improvements */ 1181 $('iframe').each( function() { 1182 var iframe_src = $(this).attr('src'); 1183 if( iframe_src ) { 1184 if( iframe_src.indexOf("youtube.com") !== -1 ) { 1185 return this.src + '?title=0&byline=0&portrait=0'; 1186 } 1187 } 1188 }); 1189 1190 1191 /* Titlebar parallax */ 1192 if( $(window).width() >= 768 ) { 1193 $('.sh-titlebar-parallax').jarallax({ 1194 speed: 0.5 1195 }); 1196 } else { 1197 $('.sh-titlebar-parallax').addClass('sh-titlebar-parallax-disabled'); 1198 } 1199 1200 1201 /* Image Gallery SC */ 1202 $('.sh-image-gallery:not(.sh-image-gallery-simple)').each( function() { 1203 var image_gallery_columns = parseInt( $(this).attr('data-columns') ); 1204 if( isNaN( image_gallery_columns ) ) { 1205 image_gallery_columns = 1; 1206 } 1207 1208 if( image_gallery_columns >= 3 ) { 1209 var image_gallery_1024 = 3; 1210 } else { 1211 var image_gallery_1024 = image_gallery_columns; 1212 } 1213 1214 if( image_gallery_columns >= 2 ) { 1215 var image_gallery_600 = 2; 1216 } else { 1217 var image_gallery_600 = image_gallery_columns; 1218 } 1219 1220 var image_gallery_autoplay = parseInt( $(this).attr('data-autoplay') ); 1221 if( image_gallery_autoplay > 0 ) { 1222 var image_gallery_autoplay_status = true; 1223 var image_gallery_autoplay_speed = parseInt( image_gallery_autoplay ); 1224 } else { 1225 var image_gallery_autoplay_status = false; 1226 var image_gallery_autoplay_speed = 0; 1227 } 1228 var image_gallery_infinite = ( image_gallery_autoplay_status == true ) ? true : false; 1229 1230 $(this).slick({ 1231 infinite: image_gallery_infinite, 1232 dots: true, 1233 slidesToShow: image_gallery_columns, 1234 slidesToScroll: image_gallery_columns, 1235 autoplay: image_gallery_autoplay_status, 1236 autoplaySpeed: image_gallery_autoplay_speed, 1237 responsive: [ 1238 { 1239 breakpoint: 1024, 1240 settings: { 1241 slidesToShow: image_gallery_1024, 1242 slidesToScroll: image_gallery_1024, 1243 } 1244 },{ 1245 breakpoint: 600, 1246 settings: { 1247 slidesToShow: image_gallery_600, 1248 slidesToScroll: image_gallery_600 1249 } 1250 },{ 1251 breakpoint: 480, 1252 settings: { 1253 slidesToShow: 1, 1254 slidesToScroll: 1 1255 } 1256 } 1257 ] 1258 }); 1259 }); 1260 $('.sh-image-gallery-item.slick-slide.slick-cloned a').attr( 'data-rel', '' ); 1261 $('.sh-image-gallery-item .post-meta-thumb a').on( 'click', function(){ 1262 $('.sh-image-gallery-item.slick-slide.slick-cloned a').attr( 'data-rel', '' ); 1263 });
1264 1265 1266 /* WooCommerce Jevelin Lightbox */ 1267 if( jevelin.wc_lightbox == 'jevelin' ) { 1268 $('.woocommerce div.product .woocommerce-product-gallery__wrapper a').attr('data-rel', 'lightcase:gallery'); 1269 } 1270 1271 1272 /* Lightbox */ 1273 $("a[data-rel^=lightcase], a[rel^='sh-lightbox'], a[rel^='lightbox']" ).lightcase({ 1274 maxWidth: jevelin.lightbox_window_max_width, 1275 maxHeight: jevelin.lightbox_window_max_height, 1276 overlayOpacity: jevelin.lightbox_opacity, 1277 transition: jevelin.lightbox_transition, 1278 showSequenceInfo: true, 1279 showCaption: false, 1280 shrinkFactor: jevelin.lightbox_window_size, 1281 }); 1282 1283 1284 /* Shop categories widget */ 1285 $('.product-categories .count').each(function() { 1286 $(this).html( $(this).html().slice(1, -1)).show(); 1287 }); 1288 1289 1290 /* Blog categories widget */ 1291 $('.widget_categories li').each(function() { 1292 var cat_count = $(this).clone().children().remove().end().text().trim().slice(1, -1); 1293 if( cat_count ) { 1294 $(this).append( '<span class="count">' + cat_count + '</span>' ); 1295 } 1296 }); 1297 1298 1299 /* Column shadow */ 1300 $('.sh-column-shadow').parent().parent().css('z-index','500'); 1301 1302 1303 /* Share */ 1304 $('.sh-social-share-button').on( 'click', function() { 1305 $(this).next().toggleClass('sh-social-share-networks-active'); 1306 }); 1307 1308 1309 /* Vidoe Player */ 1310 $('.sh-video-player-image-placeholder').on( 'click', function() { 1311 $(this).removeClass('sh-video-player-image-placeholder'); 1312 1313 var videoURL = $(this).find('iframe').prop('src'); 1314 if( !videoURL.match(/vimeo.com/) ){ 1315 videoURL += "&autoplay=1"; 1316 } 1317 $(this).find('iframe').prop('src',videoURL); 1318 }); 1319 1320 1321 /* Partners Carousel */ 1322 $('.sh-partners-carousel').each( function() { 1323 var partner_autoplay = parseInt( $(this).attr('data-autoplay') ); 1324 var partner_carousel_columns = parseInt( $(this).attr('data-id') ); 1325 var partner_carousel_columns_responsive1 = partner_carousel_columns; 1326 var partner_carousel_columns_responsive2 = 2; 1327 1328 if( partner_carousel_columns > 4 ) { 1329 partner_carousel_columns_responsive1 = 4; 1330 } 1331 1332 if( partner_carousel_columns == 1 ) { 1333 partner_carousel_columns_responsive2 = 1; 1334 } 1335 1336 if( partner_autoplay < 1 || !partner_autoplay ) { 1337 partner_autoplay = 5000; 1338 } 1339 1340 $(this).slick({ 1341 infinite: true, 1342 dots: false, 1343 arrows: false, 1344 slidesToShow: partner_carousel_columns, 1345 slidesToScroll: 1, 1346 autoplay: true, 1347 autoplaySpeed: partner_autoplay, 1348 responsive: [ 1349 { 1350 breakpoint: 1025, 1351 settings: { 1352 slidesToShow: partner_carousel_columns_responsive1 1353 } 1354 },{ 1355 breakpoint: 800, 1356 settings: { 1357 slidesToShow: partner_carousel_columns_responsive2, 1358 pauseOnHover: false 1359 } 1360 },{ 1361 breakpoint: 550, 1362 settings: { 1363 slidesToShow: 1, 1364 pauseOnHover: false 1365 } 1366 } 1367 ], 1368 }); 1369 }) 1370 1371 1372 /* WooCommerce Carousel */ 1373 $('.sh-recent-products-carousel .products').each( function() { 1374 var carousel_columns = parseInt( $(this).parent().parent().parent().attr('data-id') ); 1375 var carousel_columns_responsive1 = carousel_columns; 1376 var carousel_columns_responsive2 = 2; 1377 1378 if( carousel_columns > 4 ) { 1379 carousel_columns_responsive1 = 4; 1380 } 1381 1382 if( carousel_columns == 1 ) { 1383 carousel_columns_responsive2 = 1; 1384 } 1385 1386 $(this).slick({ 1387 infinite: true, 1388 dots: true, 1389 arrows: false, 1390 slidesToShow: carousel_columns, 1391 slidesToScroll: carousel_columns, 1392 autoplay: true, 1393 autoplaySpeed: 5000, 1394 responsive: [ 1395 { 1396 breakpoint: 1025, 1397 settings: { 1398 slidesToShow: carousel_columns_responsive1, 1399 slidesToScroll: carousel_columns_responsive1, 1400 } 1401 },{ 1402 breakpoint: 800, 1403 settings: { 1404 slidesToShow: carousel_columns_responsive2, 1405 slidesToScroll: carousel_columns_responsive2, 1406 pauseOnHover: false 1407 } 1408 },{ 1409 breakpoint: 550, 1410 settings: { 1411 slidesToShow: 1, 1412 slidesToScroll: 1, 1413 pauseOnHover: false 1414 } 1415 } 1416 ], 1417 }); 1418 }) 1419 1420 1421 /* Blog Posts Carousel */ 1422 $('.sh-recent-posts-carousel .blog-list').each( function() { 1423 var desktop_slides = parseInt( $(this).parent().attr('data-id') ); 1424 if( desktop_slides == 4 || desktop_slides == 5 ) { 1425 var desktop_slides = 3; 1426 } 1427 1428 $(this).slick({ 1429 infinite: true, 1430 dots: true,
1431 arrows: false, 1432 slidesToShow: desktop_slides, 1433 slidesToScroll: desktop_slides, 1434 autoplay: true, 1435 autoplaySpeed: 5000, 1436 responsive: [ 1437 { 1438 breakpoint: 1025, 1439 settings: { 1440 slidesToShow: desktop_slides, 1441 slidesToScroll: desktop_slides, 1442 } 1443 },{ 1444 breakpoint: 800, 1445 settings: { 1446 slidesToShow: 2, 1447 slidesToScroll: 2, 1448 pauseOnHover: false 1449 } 1450 },{ 1451 breakpoint: 550, 1452 settings: { 1453 slidesToShow: 1, 1454 slidesToScroll: 1, 1455 pauseOnHover: false 1456 } 1457 } 1458 ], 1459 }); 1460 }); 1461 1462 1463 /* Partners Carousel Responsive */ 1464 $('.sh-partners-carousel').on('init setPosition', function(event, slick, currentSlide, nextSlide){ 1465 var self = $(this); 1466 var max_height = 0; 1467 self.find('.slick-slide img').each(function() { 1468 var cur_height = $(this).height(); 1469 if (cur_height > max_height) { 1470 max_height = cur_height; 1471 } 1472 }); 1473 1474 if( max_height > 0 ) { 1475 self.css('max-height', max_height); 1476 self.find('.slick-slide').each( function() { 1477 $(this).height( max_height ); 1478 }); 1479 } 1480 1481 self.css('height', 'auto').css('opacity', '1'); 1482 }); 1483 1484 1485 /* Header navigation */ 1486 function jevelin_navigation() { 1487 if( $('.sh-header.sh-header-megamenu-style2').length ) { 1488 $("ul.sh-nav").superfish({ 1489 delay: jevelin.header_animation_dropdown_delay, 1490 hoverClass: 'sh-hover', 1491 animation: { opacity: "show", marginTop: "0px" }, 1492 animationOut: { opacity: "hide", marginTop: "-10px" }, 1493 easing: jevelin.header_animation_dropdown, 1494 speed: parseInt( jevelin.header_animation_dropdown_speed ), 1495 speedOut: 0,
1496 cssArrows: false, 1497 pathLevels: 2, 1498 }); 1499 } else { 1500 $("ul.sh-nav").superfish({ 1501 delay: jevelin.header_animation_dropdown_delay, 1502 hoverClass: 'sh-hover', 1503 animation: { opacity: "show", height:'show' }, 1504 animationOut: { opacity: "hide", height:'hide' }, 1505 easing: jevelin.header_animation_dropdown, 1506 speed: parseInt( jevelin.header_animation_dropdown_speed ), 1507 speedOut: 0, 1508 cssArrows: false, 1509 pathLevels: 2, 1510 }); 1511 } 1512 } 1513 jevelin_navigation(); 1514 if( !$('header.primary-desktop .sh-nav-social').find('a').length ) { 1515 $('header.primary-desktop .sh-nav-social').remove(); 1516 } 1517 1518 1519 /* Mobile header dropdown */ 1520 var mobile_header_dropdown_align = 0; 1521 $('.sh-header-mobile .sh-nav-dropdown').on( 'click', function() { 1522 if( mobile_header_dropdown_align == 0 ) { 1523 mobile_header_dropdown_align++; 1524 $('.sh-nav-mobile > li > a, .sh-nav-mobile li.menu-item-has-children > a, .sh-header-mobile li.mega-menu-col > a').each( function() { 1525 if( $(this).attr('href') != '' && $(this).attr('href') != '#' ) { 1526 var link_target = $(this).attr( 'target' ); 1527 if( link_target != '_blank' ) { 1528 link_target = '_self'; 1529 } 1530 1531 $(this).parent().prepend('<a href="'+ $(this).attr('href') +'" target="'+ link_target +'" class="menu-item-open-fix">'+ $(this).html() +'</a>'); 1532 $(this).html(' ') 1533 } 1534 }); 1535 } 1536 1537 1538 var self_icon_image = $(this).find('.sh-nav-custom-icon-image'); 1539 if( self_icon_image.hasClass( 'active' ) ) { 1540 self_icon_image.removeClass( 'active' ); 1541 } else { 1542 self_icon_image.addClass( 'active' ); 1543 } 1544 1545 1546 $('.sh-header-mobile-dropdown').stop(true, true).slideToggle( 1547 jevelin.header_animation_dropdown_speed, 1548 jevelin.header_animation_dropdown 1549 ); 1550 1551 return false; 1552 }); 1553 1554 1555 /* Mega Menu Column Link */ 1556 $('.sh-header li.mega-menu-col > a').on( 'click', function() { 1557 window.location = $(this).attr('href'); 1558 }); 1559 1560 1561 /* Notice */ 1562 if( jevelin.notice !== false ) { 1563 if( jevelin.notice == 'enable2' ) { 1564 1565 $('.sh-page-notice').show(); 1566 $(".sh-page-notice-button").on('click', function() { 1567 1568 $('.sh-page-notice').hide(); 1569 $('header.primary-mobile').css('height', $('.sh-header-mobile-navigation').actual( 'height' ) ); 1570 return false; 1571 }); 1572 1573 } else { 1574 1575 if ( 'set' !== $.cookie( 'sh-notice' ) ) { 1576 $('.sh-page-notice').show(); 1577 $(".sh-page-notice-button").on('click', function() { 1578 $.cookie( 'sh-notice', 'set', { expires: 356, path: '/' }); 1579 1580 $('.sh-page-notice').hide(); 1581 $('header.primary-mobile').css('height', $('.sh-header-mobile-navigation').actual( 'height' ) ); 1582 return false; 1583 }); 1584 } 1585 1586 } 1587 } 1588 1589 1590 /* Page loader */ 1591 if( jevelin.page_loader == 1 ) { 1592 $(".sh-page-loader").fadeOut(500); 1593 $("body").css('overflow', 'visible'); 1594 1595 $(window).bind('beforeunload', function(e){ 1596 $('.sh-page-loader').fadeIn(); 1597 }); 1598 } 1599 1600 1601 /* WooCommerce - Page Numbers */ 1602 $(".woocommerce-pagination .page-numbers .prev").html( jevelin.page_numbers_prev ); 1603 $(".woocommerce-pagination .page-numbers .next").html( jevelin.page_numbers_next ); 1604 1605 1606 /* RTL support */ 1607 if( jevelin.rtl_support == 1 ) { 1608 $('.sh-filter').each(function(){ 1609 $(this).find('.sh-filter-item:first-child').appendTo(this); 1610 }); 1611 1612 $('.sh-portfolio-single-info-item').each(function(){ 1613 $(this).find('.sh-portfolio-single-info-left').appendTo(this); 1614 }); 1615 1616 $('.sh-progress-style4 .sh-progress-item .row').each(function(){ 1617 $(this).find('.col-md-8').appendTo(this); 1618 }); 1619 1620 $('.sh-progress-style5 .sh-progress-item .row').each(function(){ 1621 $(this).find('.col-md-8').appendTo(this); 1622 }); 1623 1624 $('.sh-counter-style3 > .sh-table').each(function(){ 1625 $(this).find('.text-right').appendTo(this); 1626 }); 1627 1628 $('.sh-copyrights-style2 > .sh-table-full > .sh-table-cell:first-child').appendTo('.sh-copyrights-style2 > .sh-table-full'); 1629 $('.sh-header:not(.sh-header-7) > .container > .sh-table > .sh-table-cell:first-child').appendTo('.sh-header > .container > .sh-table'); 1630 1631 $('.sh-header:not(.sh-header-7) .sh-nav .menu-item.sh-nav-cart').prependTo('.sh-header .sh-nav'); 1632 $('.sh-header:not(.sh-header-7) .sh-nav .menu-item.sh-nav-search').prependTo('.sh-header .sh-nav'); 1633 $('.sh-header:not(.sh-header-7) .sh-nav .menu-item.sh-nav-social').prependTo('.sh-header .sh-nav'); 1634 1635 $('.sh-header-top-2 > .container > .row > .header-contacts').appendTo('.sh-header-top-2 > .container > .row'); 1636 $('.sh-header-top-3 > .container > .sh-table > .header-contacts').appendTo('.sh-header-top-3 > .container > .sh-table'); 1637 } 1638 1639 1640 /* Footer Parallax */ 1641 function jevelin_footer_parallax() { 1642 if ($(document).width() > 850) { 1643 $("#wrapper > .content-container").css( 'margin-bottom', $('.sh-footer').height() ); 1644 } else { 1645 $("#wrapper > .content-container").css( 'margin-bottom', '' ); 1646 } 1647 } 1648 1649 function jevelin_footer_parallax_visible() { 1650 if ($(document).width() > 850) { 1651 if( ( $(document).height() - ($(window).scrollTop() + $(window).height()) ) < $('.sh-footer').height() ) { 1652 $('.sh-footer').css( 'opacity', '1'); 1653 } else { 1654 $('.sh-footer').css( 'opacity', '0'); 1655 } 1656 } 1657 } 1658 1659 if( jevelin.footer_parallax == 1 ) { 1660 $("body").addClass( 'sh-footer-paralalx-init' ); 1661 1662 $(window).load(function (){ 1663 jevelin_footer_parallax();
1664 jevelin_footer_parallax_visible(); 1665 }); 1666 1667 $(window).resize(function() { 1668 clearTimeout(window.resizedFinishedFooter); 1669 window.resizedFinishedFooter = setTimeout(function(){ 1670 1671 jevelin_footer_parallax(); 1672 1673 }, 500); 1674 }); 1675 1676 $(window).scroll(jevelin_footer_parallax_visible); 1677 } 1678 1679 1680 /* WooCommerce Button Change */ 1681 $('.sh-woocommerce-products-style2 li.product').each( function() { 1682 var button_html = ''; 1683 if( $(this).find('.add_to_cart_button').length ) { 1684 button_html = $(this).find('.add_to_cart_button')[0].outerHTML; 1685 } 1686 $(this).find('.sh-woo-post-content-container > a:first-child').append( button_html ); 1687 $(this).find('.sh-woo-post-content-container > .add_to_cart_button').remove(); 1688 }); 1689 1690 1691 /* Admin Preview (beta) */ 1692 $('.sh-unyson-frontend-test').on( 'click', function() { 1693 $(this).toggleClass( "active" ); 1694 $('#content.page-content').toggleClass( "sh-unyson-frontend-preview" ); 1695 }); 1696 1697 1698 /* AJAX - Lazy Load */ 1699 if( $('.sh-load-more:not(.sh-load-more-product)').length ) { 1700 if( $('.sh-load-more.infinite').length ) { 1701 $(window).scroll( function() { 1702 if( $('.sh-load-more').length && $('.sh-load-more').isInViewport() ) { 1703 if( $('.sh-load-more:not(.disabled)').length ) { 1704 jevelin_loadmore(); 1705 } 1706 } else if( !$('.sh-load-more').length ) { 1707 $(this).off(); 1708 } 1709 }); 1710 } 1711 1712 jQuery( document ).on( 'click', '.sh-load-more:not(.disabled)', function() { 1713 jevelin_loadmore(); 1714 }); 1715 1716 function jevelin_loadmore() { 1717 var lazy_self = $('.sh-load-more'); 1718 lazy_self.addClass( 'disabled' ); 1719 var lazy_categories = lazy_self.attr('data-categories'); 1720 var lazy_post_style = lazy_self.attr('data-post-style'); 1721 var lazy_posts_per_page = lazy_self.attr('data-posts-per-page'); 1722 var lazy_paged = lazy_self.attr('data-paged'); 1723 jQuery.ajax({ 1724 url : jevelin_loadmore_posts.ajax_url, 1725 type : 'post', 1726 data : { 1727 action : 'load_more_posts', 1728 categories : lazy_categories, 1729 per_page: lazy_posts_per_page, 1730 post_style : lazy_post_style, 1731 paged: lazy_paged, 1732 }, 1733 success : function( response ) { 1734 if( response == 'done' ) { 1735 $('.sh-load-more').remove(); 1736 } else { 1737 $('.sh-load-more').attr('data-paged', parseInt( $('.sh-load-more').attr('data-paged') ) + 1 ); 1738 1739 if( lazy_self.attr( 'data-id' ) ) { 1740 1741 var lazy_add_posts = $( '.content-container .'+ lazy_self.attr( 'data-id' ) +' .blog-list' ); 1742 if( lazy_add_posts.hasClass('blog-style-masonry') ) { 1743 // console.log('yes'); 1744 lazy_add_posts.isotope( 'insert', $(response) ).imagesLoaded( function() { 1745 lazy_add_posts.isotope('layout').css( 'opacity', 1 ); 1746 }); 1747 } else { 1748 $(response).appendTo( '.content-container .'+ lazy_self.attr( 'data-id' ) +' .blog-list' ); 1749 } 1750 1751 } else { 1752 if( $( '.blog-list.blog-style-masonry' ).length ) { 1753 $( '.blog-list.blog-style-masonry' ).isotope( 'insert', $(response) ).imagesLoaded( function() { 1754 $( '.blog-list.blog-style-masonry' ).isotope('layout').css( 'opacity', 1 ); 1755 }); 1756 } else { 1757 $(response).appendTo( '.content-container .blog-list' ).hide().fadeIn( 700 ); 1758 } 1759 } 1760 1761 lazy_self.removeClass( 'disabled' ); 1762 if( $(response).filter('.post-item').length < lazy_posts_per_page ) { 1763 $('.sh-load-more').remove(); 1764 } 1765 1766 } 1767 } 1768 }); 1769 } 1770 } 1771 1772 1773 /* AJAX - Load more products */ 1774 if( $('.sh-load-more.sh-load-more-product').length ) { 1775 if( $('.sh-load-more.sh-load-more-product.infinite').length ) { 1776 $(window).scroll( function() { 1777 if( $('.sh-load-more.sh-load-more-product').length && $('.sh-load-more.sh-load-more-product').isInViewport() ) { 1778 if( $('.sh-load-more.sh-load-more-product:not(.disabled)').length ) { 1779 jevelin_loadmore_products(); 1780 } 1781 } else if( !$('.sh-load-more.sh-load-more-product').length ) { 1782 $(this).off(); 1783 } 1784 }); 1785 } 1786 1787 jQuery( document ).on( 'click', '.sh-load-more-product:not(.disabled)', function() { 1788 jevelin_loadmore_products(); 1789 }); 1790 1791 function jevelin_loadmore_products() { 1792 var lazy_self = $('.sh-load-more-product'); 1793 lazy_self.addClass( 'disabled' ); 1794 var lazy_categories = lazy_self.attr('data-categories'); 1795 var lazy_post_style = lazy_self.attr('data-post-style'); 1796 var lazy_posts_per_page = lazy_self.attr('data-posts-per-page'); 1797 var lazy_paged = lazy_self.attr('data-paged'); 1798 jQuery.ajax({ 1799 url : jevelin_loadmore_posts.ajax_url, 1800 type : 'post', 1801 data : { 1802 action : 'load_more_products', 1803 per_page: lazy_posts_per_page, 1804 paged: lazy_paged, 1805 }, 1806 success : function( response ) { 1807 if( response == 'done' ) { 1808 $('.sh-load-more-product').remove(); 1809 } else { 1810 $(response).appendTo( '.vcg-woocommerce-products ul.products' ); 1811 1812 $('.sh-load-more-product').attr('data-paged', parseInt( $('.sh-load-more-product').attr('data-paged') ) + 1 ); 1813 lazy_self.removeClass( 'disabled' ); 1814 1815 if( $(response).filter('.type-product').length < lazy_posts_per_page ) { 1816 $('.sh-load-more-product').remove(); 1817 } 1818 1819 } 1820 } 1821 }); 1822 } 1823 } 1824 1825 1826 /* One Page Navigation - On load */ 1827 var opn_find_url = document.location.protocol +"//"+ document.location.hostname + document.location.pathname; 1828 var opn_find = 'a[href="'+opn_find_url+'#backtotop"]'; 1829 if( $(opn_find).length ) { 1830 $('header.primary-desktop .sh-nav').find('li.current_page_item').each( function() { 1831 $(this).removeClass('current_page_item'); 1832 $(opn_find).parent().addClass('current_page_item'); 1833 }); 1834 } 1835 1836 1837 /* One Page Navigation - Scroll */ 1838 if( $('#content > .vc_row').is('[id]') ) { 1839 var opn_lock = 0; 1840 $(window).on( 'load scroll', function() { 1841 var opn_lock_scroll = 0; 1842 if( opn_lock == 0 ) { 1843 $('#content > .vc_row').each( function() { 1844 if( opn_lock_scroll == 0 && $(this).is('[id]') && $(this).isInViewport() ) { 1845 var opn_find_url = document.location.protocol +"//"+ document.location.hostname + document.location.pathname; 1846 var opn_find = 'a[href="'+opn_find_url+'#'+$(this).attr('id')+'"]'; 1847 if( $(opn_find).length ) { 1848 $(opn_find).closest('ul.sh-nav').find('li.current_page_item').removeClass('current_page_item'); 1849 $(opn_find).parent().addClass('current_page_item'); 1850 } 1851 opn_lock_scroll = 1; 1852 } 1853 }); 1854 1855 if( $(window).scrollTop() == 0 ) { 1856 var opn_find_url = document.location.protocol +"//"+ document.location.hostname + document.location.pathname; 1857 var opn_find = 'a[href="'+opn_find_url+'#backtotop"]'; 1858 if( $(opn_find).length ) { 1859 $(opn_find).closest('ul.sh-nav').find('li.current_page_item').removeClass('current_page_item'); 1860 $(opn_find).parent().addClass('current_page_item'); 1861 } 1862 } 1863 } 1864 1865 }); 1866 } 1867 1868 1869 /* One Page Navigation - Click */ 1870 $('header.primary-desktop .sh-nav a').on( 'click', function() { 1871 if( $(this).is('[href]') ) { 1872 if( $(this).attr('href').length ) { 1873 var opn_current = 'div#'+$(this).attr('href').replace(/^.*?(#|$)/,''); 1874 } else { 1875 return false; 1876 } 1877 } 1878 1879 if( $(opn_current).length || opn_current == 'div#backtotop' ) { 1880 1881 $(this).closest('ul.sh-nav').find('li.current_page_item').removeClass('current_page_item'); 1882 $(this).parent().addClass('current_page_item'); 1883 opn_lock = 1; 1884 1885 setTimeout(function() { 1886 opn_lock = 0; 1887 }, 3000); 1888 1889 } 1890 });
1891 1892 1893}); 1894 1895 1896/* Load functions */ 1897(function( $ ){ 1898 1899 /* Shufflehound Carousel */ 1900 $.fn.isInViewport = function() { 1901 var elementTop = $(this).offset().top; 1902 var elementBottom = elementTop + $(this).outerHeight(); 1903 1904 var viewportTop = $(window).scrollTop(); 1905 var viewportBottom = viewportTop + $(window).height(); 1906 1907 return elementBottom > viewportTop && elementTop < viewportBottom; 1908 }; 1909 1910 $.fn.sh_carousel = function() { 1911 1912 /* Prepair Carusel */ 1913 $(this).html( '<div class="sh-carousel-items">' + $(this).html() + '</div>' ); 1914 var self_main = $(this); 1915 var self = $(this).find('.sh-carousel-items'); 1916 self.find('.blog-textslider-post:first-child').addClass( 'sh-active' ); 1917 1918 1919 /* Add Buttons */ 1920 self_main.append( '<span class="sh-carousel-buttons sh-carousel-buttons-styling"></span>' ); 1921 self_main.find( '.sh-carousel-buttons' ).append( '<span class="sh-carousel-prev"><i class="icon icon-arrow-left-circle"></i></span>' ); 1922 self_main.find( '.sh-carousel-buttons' ).append( '<span class="sh-carousel-next"><i class="icon icon-arrow-right-circle"></i></span>' ); 1923 1924 1925 /* Add Button Actions */ 1926 self_main.find('.sh-carousel-prev').on( 'click', function() { 1927 var active = self.find( '.blog-textslider-post.sh-active' ); 1928 var prev = active.prev(); 1929 1930 /* If one the last slide */ 1931 if( !prev.length ) { 1932 prev = self.find( '.blog-textslider-post:last-child' ); 1933 } 1934 1935 active.removeClass( 'sh-active' ); 1936 prev.addClass( 'sh-active' ); 1937 }); 1938 1939 self_main.find('.sh-carousel-next').on( 'click', function() { 1940 if( self.isInViewport() && !document.hidden ) { 1941 var active = self.find( '.blog-textslider-post.sh-active' ); 1942 var next = active.next(); 1943 1944 /* If one the last slide */ 1945 if( !next.length ) { 1946 next = self.find( '.blog-textslider-post:first-child' ); 1947 } 1948 1949 active.removeClass( 'sh-active' ); 1950 next.addClass( 'sh-active' ); 1951 } 1952 }); 1953 1954 1955 /* Start Carousel */ 1956 var speed = 5000; 1957 var run = setInterval( function(){ self_main.find('.sh-carousel-next').trigger('click'); }, speed); 1958 self_main.hover( 1959 function() { 1960 clearInterval(run); 1961 }, 1962 function() { 1963 run = setInterval( function(){ self_main.find('.sh-carousel-next').trigger('click'); }, speed); 1964 } 1965 ); 1966 1967 } 1968 1969})( 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.