1(function($){ 2 "use strict"; 3 4 window.App = {}; 5 6 App.SMcontroller = new ScrollMagic.Controller(); 7 8 window.onload = function () { 9 document.fonts.ready.then(function () { 10 atroposInit() 11 initialReveal() 12 }); 13 } 14 15 function atroposInit() { 16 const target = document.querySelectorAll('.js-atropos') 17 if (!target) return; 18 19 target.forEach(el => { 20 const myAtropos = Atropos({ 21 el: el, 22 // alwaysActive: true, 23 }); 24 }); 25 } 26 27 const PageReveal = (function() { 28 function base(tl) { 29 tl.add(() => { 30 RevealAnim.init(); 31 }) 32 } 33 34 function init(tl) { 35 base(tl); 36 return tl; 37 } 38 39 return { 40 init: init, 41 } 42 })(); 43 44 function initialReveal(callback) { 45 let tl = gsap.timeline(); 46 tl = PageReveal.init(tl); 47 console.log( tl ) 48 } 49 50 const RevealAnim = (function() { 51 function single() { 52 const animationTarget = document.querySelectorAll('[data-anim]'); 53 const controller = new ScrollMagic.Controller(); 54 if (!animationTarget.length) return; 55 56 for (let i = 0; i < animationTarget.length; i++) { 57 const el = animationTarget[i]; 58 59 var scene = new ScrollMagic.Scene({ 60 triggerElement: el, 61 duration: "100%" 62 }) 63 .on("enter", function( event ) { 64 animateElement(el); 65 }) 66 .addTo(controller) 67 } 68 } 69 70 function container() { 71 72 const animationContainer = document.querySelectorAll('[data-anim-wrap]'); 73 const controller = new ScrollMagic.Controller(); 74 if (!animationContainer.length) { 75 return; 76 } 77 78 for (let i = 0; i < animationContainer.length; i++) { 79 const el = animationContainer[i]; 80 81 var scene = new ScrollMagic.Scene({ 82 triggerElement: el, 83 duration: "100%" 84 }) 85 .on("enter", function( event ) { 86 const animChilds = el.querySelectorAll('[data-anim-child]'); 87 el.classList.add('animated'); 88 animChilds.forEach(el => animateElement(el)); 89 }) 90 .addTo(controller) 91 } 92 } 93 94 function animateElement(target) { 95 96 let attrVal; 97 let animDelay; 98 let attrDelayPart; 99 100 if (target.getAttribute('data-anim')) { 101 attrVal = target.getAttribute('data-anim'); 102 } else { 103 attrVal = target.getAttribute('data-anim-child'); 104 } 105 106 if (attrVal.includes('delay-')) { 107 attrDelayPart = attrVal.split(' ').pop(); 108 animDelay = attrDelayPart.substr(attrDelayPart.indexOf('-') + 1) / 10; 109 } 110 111 if (attrVal.includes('counter')) { 112 counter(target, animDelay); 113 } 114 else if (attrVal.includes('line-chart')) { 115 lineChart(target, animDelay); 116 } 117 else if (attrVal.includes('pie-chart')) { 118 pieChart(target, animDelay); 119 } 120 else if (attrVal.includes('split-lines')) { 121 splitLines(target, animDelay); 122 } 123 else { 124 target.classList.add('is-in-view'); 125 } 126 127 } 128 129 function pieChart(target, animDelay = 0) { 130 131 const counterVal = target.getAttribute('data-percent'); 132 const chartBar = target.querySelector('.js-chart-bar'); 133 134 if (counterVal < 0) { counterVal = 0;} 135 if (counterVal > 100) { counterVal = 100;} 136 137 gsap.fromTo(chartBar, { 138 drawSVG: `0%`, 139 }, { 140 delay: 0.3 + animDelay, 141 duration: 1.4, 142 ease: 'power3.inOut', 143 drawSVG: `${counterVal}%`, 144 145 onStart: () => { 146 chartBar.classList.remove('bar-stroke-hidden'); 147 } 148 }); 149 150 151 let object = { count: 0 }; 152 const barPercent = target.querySelector('.js-chart-percent'); 153 154 gsap.to(object, { 155 count: counterVal, 156 delay: 0.45 + animDelay, 157 duration: 1, 158 ease: 'power3.inOut', 159 160 onUpdate: function() { 161 barPercent.innerHTML = Math.round(object.count) + '%'; 162 }, 163 }); 164 165 } 166 167 function lineChart(target, animDelay = 0) { 168 169 const counterVal = target.getAttribute('data-percent'); 170 171 gsap.fromTo(target.querySelector('.js-bar'), { 172 scaleX: 0, 173 }, { 174 delay: 0.45 + animDelay, 175 duration: 1, 176 ease: 'power3.inOut', 177 scaleX: counterVal / 100, 178 }) 179 180 181 let object = { count: 0 }; 182 const barPercent = target.querySelector('.js-number'); 183 184 gsap.to(object, { 185 count: counterVal, 186 delay: 0.45 + animDelay, 187 duration: 1, 188 ease: 'power3.inOut', 189 190 onUpdate: function() { 191 barPercent.innerHTML = Math.round(object.count); 192 }, 193 }); 194 195 } 196 197 function counter(target, animDelay = 0) { 198 199 const counterVal = target.getAttribute('data-counter'); 200 const counterAdd = target.getAttribute('data-counter-add'); 201 const totalDelay = animDelay; 202 let symbols = ''; 203 204 let object = { count: 0 }; 205 const counterNum = target.querySelector('.js-counter-num'); 206 207 if (counterAdd) { 208 symbols = counterAdd; 209 } 210 211 gsap.to(object, { 212 count: counterVal, 213 delay: totalDelay, 214 duration: 1.8, 215 ease: 'power3.inOut', 216 217 onUpdate: function() { 218 counterNum.innerHTML = Math.round(object.count) + symbols; 219 }, 220 }); 221 222 } 223 224 function splitLines(target, animDelay = 0) { 225 226 const lines = target.querySelectorAll('.split__line'); 227 228 gsap.to(lines, { 229 delay: animDelay, 230 stagger: 0.05, 231 duration: 1.2, 232 ease: 'power2.out', 233 y: '0%', 234 }); 235 236 } 237 238
239 function init() { 240 241 single(); 242 container(); 243 244 } 245 246 247 return { 248 init: init, 249 } 250 })(); 251 252 $.fn.gdlr_core_vertical_accordion = function( filter_elem ){ 253 if( typeof(filter_elem) == 'undefined' ){ 254 var elem = $(this).find('.gdlr-core-tab-feature-item'); 255 }else{ 256 var elem = filter_elem.filter('.gdlr-core-tab-feature-item'); 257 } 258 259 const targets = document.querySelectorAll(".js-accordion"); 260 261 if (!targets) return; 262 263 for (let i = 0; i < targets.length; i++) { 264 const items = targets[i].querySelectorAll('.accordion__item'); 265 266 for (let l = 0; l < items.length; l++) { 267 items[l].addEventListener("click", (e) => { 268 items[l].classList.toggle('is-active'); 269 const content = items[l].querySelector('.accordion__content'); 270 271 if (content.style.maxHeight) { 272 content.style.maxHeight = null; 273 } else { 274 content.style.maxHeight = content.scrollHeight + "px"; 275 } 276 }); 277 } 278 } 279 280 return $(this); 281 } 282 283 $.fn.gdlr_core_scrollmagic = function( filter_elem ){ 284 if( typeof(filter_elem) == 'undefined' ){ 285 var elem = $(this).find('.gdlr-core-scrollmagic-pin-spacer'); 286 }else{ 287 var elem = filter_elem.filter('.gdlr-core-scrollmagic-pin-spacer'); 288 } 289 290 const target = document.querySelector('.js-pin-menu'); 291 if (!target) return; 292 293 const sceneDuration = '100%'; 294 const sceneOffset = document.querySelector('.sassio-header-wrap').offsetHeight; 295 let trHook = "onLeave"; 296 297 const scene = new ScrollMagic.Scene({ 298 duration: sceneDuration - sceneOffset, 299 offset: '-' + sceneOffset + 'px', 300 triggerElement: target, 301 triggerHook: trHook, 302 }) 303 .setPin(".js-pin-menu") 304 .addTo(App.SMcontroller) 305 306 window.addEventListener('resize', () => { 307 const sceneOffset = document.querySelector('.sassio-header-wrap').offsetHeight; 308 scene.duration(sceneDuration - sceneOffset); 309 scene.offset('-' + sceneOffset + 'px'); 310 scene.refresh(); 311 }) 312 313 return $(this); 314 } 315 316 $.fn.gdlr_core_tab_feature_3 = function( filter_elem ){ 317 318 if( typeof(filter_elem) == 'undefined' ){ 319 var elem = $(this).find('.gdlr-core-tab-feature3-item, .gdlr-core-roadmap-item'); 320 }else{ 321 var elem = filter_elem.filter('.gdlr-core-tab-feature3-item, .gdlr-core-roadmap-item'); 322 } 323 324 elem.each(function(){ 325 326 // click action 327 $(this).find('.gdlr-core-tab-feature3-title-wrap, .gdlr-core-roadmap-item-head').click(function(){ 328 329 $(this).parent().find('.gdlr-core-active').removeClass('gdlr-core-active'); 330 331 var tab_id = $(this).attr('data-tab-id'); 332 333 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 334 335 $(this).parents('.gdlr-core-tab-feature3-item').find('.gdlr-core-tab-feature3-content-wrap.gdlr-core-active').removeClass('gdlr-core-active'); 336 337 $(this).parents('.gdlr-core-tab-feature3-item').find('.gdlr-core-tab-feature3-content-wrap[data-tab-id="' + tab_id + '"]').addClass('gdlr-core-active'); 338 }); 339 340 }); 341 } // gdlr_core_tab 342 343 344 $.fn.gdlr_core_masthead = function( filter_elem ){ 345 346 if( typeof(filter_elem) == 'undefined' ){ 347 var elem = $(this).find('.gdlr-core-masthead-item'); 348 }else{ 349 var elem = filter_elem.filter('.gdlr-core-masthead-item'); 350 } 351 352 const masthead_1_target = document.querySelector('#js-masthead-1-particles'); 353 if ( masthead_1_target ) { 354 particlesJS("js-masthead-1-particles", { 355 "particles": { 356 "number": { 357 "value": 15, 358 "density": { 359 "enable": false, 360 "value_area": 200 361 } 362 }, 363 "color": { 364 "value": ["#00ff96", "#0044EB", "#1A3454"] 365 }, 366 "shape": { 367 "type": "circle", 368 "stroke": { 369 "width": 0, 370 "color": "#000000" 371 }, 372 "polygon": { 373 "nb_sides": 5 374 }, 375 }, 376 "opacity": { 377 "value": 0.5, 378 "random": false, 379 "anim": { 380 "enable": false, 381 "speed": 1, 382 "opacity_min": 0.1, 383 "sync": false 384 } 385 }, 386 "size": { 387 "value": 6, 388 "random": true, 389 "anim": { 390 "enable": false, 391 "speed": 20, 392 "size_min": 0.1, 393 "sync": false 394 } 395 }, 396 "line_linked": { 397 "enable": false, 398 "distance": 150, 399 "color": "#ffffff", 400 "opacity": 0.4, 401 "width": 1 402 }, 403 "move": { 404 "enable": true, 405 "speed": 2, 406 "direction": "none", 407 "random": false, 408 "straight": false, 409 "out_mode": "bounce", 410 "bounce": false, 411 "attract": { 412 "enable": false, 413 "rotateX": 600, 414 "rotateY": 1200 415 } 416 } 417 }, 418 "interactivity": { 419 "detect_on": "canvas", 420 "events": { 421 "onhover": { 422 "enable": false, 423 "mode": "repulse" 424 }, 425 "onclick": { 426 "enable": false, 427 "mode": "push" 428 }, 429 "resize": false 430 }, 431 "modes": { 432 "grab": { 433 "distance": 400, 434 "line_linked": { 435 "opacity": 1 436 } 437 }, 438 "bubble": { 439 "distance": 400, 440 "size": 40, 441 "duration": 2, 442 "opacity": 8, 443 "speed": 3 444 }, 445 "repulse": { 446 "distance": 200, 447 "duration": 0.4 448 }, 449 "push": { 450 "particles_nb": 4 451 }, 452 "remove": { 453 "particles_nb": 2 454 } 455 } 456 }, 457 "retina_detect": true 458 }); 459 } else { 460 const target = document.querySelectorAll('[data-particles-image]'); 461 462 if ( target ) { 463 const makeParticlesLayer = (layerId, imagePath, number = 2, size = 10, width = 100, height = 100) => { 464 let shapes = { 465 "type": "image", 466 "image": { 467 "src": imagePath, 468 "width": width, 469 "height": height 470 }, 471 } 472 473 if (!imagePath) { 474 shapes = { 475 "type": "circle", 476 "stroke": { 477 "width": 0, 478 "color": "#000000" 479 }, 480 "polygon": { 481 "nb_sides": 5 482 }, 483 } 484 } 485 486 particlesJS(layerId, { 487 "particles": { 488 "number": { 489 "value": number, 490 "density": { 491 "enable": false, 492 "value_area": 200 493 } 494 }, 495 "color": { 496 "value": ["#00ff96", "#0044EB", "#1A3454"] 497 }, 498 "shape": shapes, 499 "opacity": { 500 "value": 0.7, 501 "random": false, 502 }, 503 "size": { 504 "value": size, 505 "random": false, 506 }, 507 "line_linked": { 508 "enable": false, 509 "distance": 150, 510 "color": "#ffffff", 511 "opacity": 0.4, 512 "width": 1 513 }, 514 "move": { 515 "enable": true, 516 "speed": 1, 517 "direction": "none", 518 "random": false, 519 "straight": false, 520 "out_mode": "bounce", 521 "bounce": false, 522 "attract": { 523 "enable": false, 524 "rotateX": 600, 525 "rotateY": 1200 526 } 527 } 528 }, 529 "interactivity": { 530 "detect_on": "canvas", 531 "events": { 532 "onhover": { 533 "enable": false, 534 "mode": "repulse" 535 }, 536 "onclick": { 537 "enable": false, 538 "mode": "push" 539 }, 540 "resize": false 541 }, 542 "modes": { 543 "grab": { 544 "distance": 400, 545 "line_linked": { 546 "opacity": 1 547 } 548 }, 549 "bubble": { 550 "distance": 400, 551 "size": 40, 552 "duration": 2, 553 "opacity": 8, 554 "speed": 3 555 }, 556 "repulse": { 557 "distance": 200, 558 "duration": 0.4 559 }, 560 "push": { 561 "particles_nb": 4 562 }, 563 "remove": { 564 "particles_nb": 2 565 } 566 } 567 }, 568 "retina_detect": true 569 }); 570 } 571 572 target.forEach(el => { 573 const imagePath = el.getAttribute('data-particles-image') 574 const id = el.id 575 let width = 100 576 let height = 100 577 let number = 2 578 let size = 10 579 580 if (el.getAttribute("data-particles-image-width")) 581 width = el.getAttribute("data-particles-image-width") 582 583 if (el.getAttribute("data-particles-image-height")) 584 height = el.getAttribute("data-particles-image-height") 585 586 if (el.getAttribute("data-particles-image-number")) 587 number = el.getAttribute("data-particles-image-number") 588 589 if (el.getAttribute("data-particles-image-size")) 590 size = el.getAttribute("data-particles-image-size") 591 592 makeParticlesLayer(id, imagePath, number, size, width, height) 593 }); 594 } 595 } 596 } 597 598 $.fn.gdlr_core_image_parallax = function( filter_elem ){ 599 if( typeof(filter_elem) == 'undefined' ){ 600 var elem = $(this).find('.gdlr-core-image-parallax-item'); 601 }else{ 602 var elem = filter_elem.filter('.gdlr-core-image-parallax-item'); 603 } 604 605 const target = document.querySelectorAll('[data-parallax]'); 606 607 target.forEach(el => { 608 const value = el.getAttribute('data-parallax'); 609 610 jarallax(el, { 611 speed: value, 612 imgElement: '.jarallax-img', 613 }); 614 }); 615 } 616 617 $.fn.gdlr_core_content_list_script = function( filter_elem ){ 618 619 if( typeof(filter_elem) == 'undefined' ){ 620 var elem = $(this).find('.gdlr-core-image-content-list-item'); 621 }else{ 622 var elem = filter_elem.filter('.gdlr-core-image-content-list-item'); 623 } 624 625 $('.js-content-rellax').each( function( i, el ) { 626 var rellax = new Rellax( el, { 627 breakpoints: [576, 768, 1025] 628 }); 629 } ); 630 } 631 632 $.fn.gdlr_core_image_decor = function( filter_elem ){ 633 if( typeof(filter_elem) == 'undefined' ){ 634 var elem = $(this).find('.gdlr-image-decor-style4'); 635 }else{ 636 var elem = filter_elem.filter('.gdlr-image-decor-style4'); 637 } 638 639 const target = document.querySelectorAll('.js-rellax') 640 if (!target) return; 641 642 var rellax = new Rellax('.js-rellax', { 643 speed: -2, 644 center: false, 645 wrapper: null, 646 round: true, 647 vertical: true, 648 horizontal: false 649 }); 650 651 return $(this); 652 } 653 654 $.fn.gdlr_core_vertical_tab = function( filter_elem ){ 655 if( typeof(filter_elem) == 'undefined' ){ 656 var elem = $(this).find('.gdlr-core-vertical-item'); 657 }else{ 658 var elem = filter_elem.filter('.gdlr-core-vertical-item'); 659 } 660 661 const targets = document.querySelectorAll(".js-tabs"); 662
663 targets.forEach(el => { 664 singleTab(el) 665 }); 666 667 function singleTab(target) { 668 const controls = target.querySelector('.js-tabs-controls'); 669 const controlsItems = target.querySelectorAll('.js-tabs-controls .js-tabs-button'); 670 const content = target.querySelector('.js-tabs-content'); 671 672 for (let l = 0; l < controlsItems.length; l++) { 673 const el = controlsItems[l]; 674 675 el.addEventListener("click", (e) => { 676 const selector = el.getAttribute('data-tab-target'); 677 678 controls.querySelector('.is-active').classList.remove('is-active') 679 content.querySelector('.is-active').classList.remove('is-active') 680 681 el.classList.add('is-active') 682 content.querySelector(selector).classList.add('is-active') 683 }); 684 } 685 } 686 687 return $(this); 688 } 689 690 $.fn.gdlr_core_pricing_table = function( filter_elem ){ 691 if( typeof(filter_elem) == 'undefined' ){ 692 var elem = $(this).find('.gdlr-core-pricing-table-item'); 693 }else{ 694 var elem = filter_elem.filter('.gdlr-core-pricing-table-item'); 695 } 696 697 const target = document.querySelectorAll('[data-switch]') 698 699 if ( elem ) { 700 target.forEach(el => { 701 el.addEventListener('click', () => { 702 const trigger = el.getAttribute('data-switch'); 703 document.querySelectorAll(trigger).forEach(el => { 704 el.classList.toggle('is-active'); 705 }); 706 }); 707 }); 708 } 709 710 return $(this); 711 } 712 713 $.fn.gdlr_core_swiperslider = function( filter_elem ){ 714 const sectionSlider = document.querySelectorAll('.js-sectionSlider'); 715 if (!sectionSlider.length) return; 716 717 for (let i = 0; i < sectionSlider.length; i++) { 718 const el = sectionSlider[i]; 719 720 let gap = 0; 721 let loop = false; 722 let centered = false; 723 let pagination = false; 724 let scrollbar = false; 725 let autoplay = false; 726 727 if (el.getAttribute('data-gap')) gap = el.getAttribute('data-gap'); 728 if (el.hasAttribute('data-loop')) loop = true; 729 if (el.hasAttribute('data-center')) centered = true; 730 if (el.hasAttribute('data-autoplay')) autoplay = true; 731 732 if (el.hasAttribute('data-pagination')) { 733 pagination = { 734 el: el.querySelector('.js-pagination'), 735 bulletClass: 'pagination__item', 736 bulletActiveClass: 'is-active', 737 bulletElement: 'div', 738 clickable: true 739 }; 740 } 741 742 if (el.hasAttribute('data-scrollbar')) { 743 scrollbar = { 744 el: '.js-scrollbar', 745 draggable: false, 746 } 747 } 748 749 const colsArray = el.getAttribute('data-slider-col').split(' '); 750 751 let cols_base = 1; 752 let cols_lg = 1; 753 let cols_md = 1; 754 let cols_sm = 1; 755 756 colsArray.forEach(el => { 757 if (el.includes('base')) cols_base = el.slice(-1); 758 if (el.includes('lg')) cols_lg = el.slice(-1); 759 if (el.includes('md')) cols_md = el.slice(-1); 760 if (el.includes('sm')) cols_sm = el.slice(-1); 761 }); 762 763 new Swiper(el, { 764 speed: 800, 765 autoHeight: true, 766 spaceBetween: parseInt(gap), 767 centeredSlides: centered, 768 autoplay : autoplay, 769 parallax: true, 770 watchSlidesVisibility: true, 771 loop: loop, 772 loopAdditionalSlides: 1, 773 preloadImages: false, 774 lazy: true, 775 scrollbar: scrollbar, 776 pagination: pagination, 777 slidesPerView: parseInt(cols_base), 778 breakpoints: { 779 1199: { slidesPerView: parseInt(cols_lg) }, 780 991: { slidesPerView: parseInt(cols_md) }, 781 767: { slidesPerView: parseInt(cols_sm) }, 782 }, 783 lazy: { 784 loadPrevNext: true, 785 }, 786 navigation: { 787 prevEl: el.querySelector('.js-prev'), 788 nextEl: el.querySelector('.js-next'), 789 }, 790 }); 791 } 792 793 return $(this); 794 } 795 796 $(document).ready(function(){ 797 $('body').each(function(){ 798 var gdlr_core_js = $(this).find('.gdlr-core-js'); 799 800 $(this).gdlr_core_vertical_tab( gdlr_core_js ); 801 802 $(this).gdlr_core_pricing_table( gdlr_core_js ); 803 804 $(this).gdlr_core_vertical_accordion( gdlr_core_js ); 805 806 $(this).gdlr_core_scrollmagic( gdlr_core_js ); 807 808 $(this).gdlr_core_image_decor( gdlr_core_js ); 809 810 $(this).gdlr_core_tab_feature_3( gdlr_core_js ); 811 812 $(this).gdlr_core_masthead( gdlr_core_js ); 813 814 $(this).gdlr_core_content_list_script( gdlr_core_js ); 815 816 $(this).gdlr_core_image_parallax( gdlr_core_js ); 817 818 if ( jQuery( '.gdlr-core-flexslider-custom-nav').length ) { 819 jQuery(".gdlr-core-flexslider-custom-nav .nav__item, .flex-nav-next, flex-nav-prev").on("mouseover", function() { 820 jQuery(".js-cursor").addClass("has-slider-icon is-active"); 821 }); 822 823 jQuery(".gdlr-core-flexslider-custom-nav .nav__item, .flex-nav-next, flex-nav-prev").on("mouseleave", function() { 824 jQuery(".js-cursor").removeClass("has-slider-icon is-active"); 825 }); 826 } 827 }); 828 }); 829 830 $(window).on('load', function(){ 831 832 $('body').each(function(){ 833 834 var gdlr_core_js = $(this).find('.gdlr-core-js-2'); 835 $(this).gdlr_core_swiperslider( gdlr_core_js ); 836 }); 837 838 }); // window.load 839 840 var sassio_display = 'desktop'; 841 if( typeof(window.matchMedia) == 'function' ){ 842 $(window).on('resize sassio-set-display', function(){ 843 if( window.matchMedia('(max-width: 419px)').matches ){ 844 sassio_display = 'mobile-portrait'; 845 }else if( window.matchMedia('(max-width: 767px)').matches ){ 846 sassio_display = 'mobile-landscape' 847 }else if( window.matchMedia('(max-width: 959px)').matches ){ 848 sassio_display = 'tablet' 849 }else{ 850 sassio_display = 'desktop'; 851 } 852 }); 853 $(window).trigger('sassio-set-display'); 854 }else{ 855 $(window).on('resize sassio-set-display', function(){ 856 if( $(window).innerWidth() <= 419 ){ 857 sassio_display = 'mobile-portrait'; 858 }else if( $(window).innerWidth() <= 767 ){ 859 sassio_display = 'mobile-landscape' 860 }else if( $(window).innerWidth() <= 959 ){ 861 sassio_display = 'tablet' 862 }else{ 863 sassio_display = 'desktop'; 864 } 865 }); 866 $(window).trigger('sassio-set-display'); 867 } 868 869 // ref : http://unscriptable.com/2009/03/20/debouncing-javascript-methods/ 870 // ensure 1 is fired 871 var sassio_debounce = function(func, threshold, execAsap){ 872 873 var timeout; 874 875 return function debounced(){ 876 877 var obj = this, args = arguments; 878 879 function delayed(){ 880 if( !execAsap ){ 881 func.apply(obj, args); 882 } 883 timeout = null; 884 }; 885 886 if( timeout ){ 887 clearTimeout(timeout); 888 }else if( execAsap ){ 889 func.apply(obj, args); 890 } 891 timeout = setTimeout(delayed, threshold); 892 }; 893 } 894 895 // reduce the event occurance 896 var sassio_throttling = function(func, threshold){ 897 898 var timeout; 899 900 return function throttled(){ 901 var obj = this, args = arguments; 902 903 function delayed(){ 904 func.apply(obj, args); 905 timeout = null; 906 }; 907 908 if( !timeout ){ 909 timeout = setTimeout(delayed, threshold); 910 } 911 }; 912 } 913 914 ///////////////////////// 915 // menu handle function 916 ///////////////////////// 917 var sassio_sf_menu = function( menu ){ 918 919 if( menu.length == 0 ) return; 920 921 this.main_menu = menu; 922 923 this.slide_bar = this.main_menu.children('.sassio-navigation-sli
923de-bar'); 924 this.slide_bar_val = { width: 0, left: 0 }; 925 this.slide_bar_offset = '15'; 926 if( this.slide_bar.attr('data-size-offset') ){ 927 this.slide_bar_offset = parseInt(this.slide_bar.attr('data-size-offset')); 928 } 929 930 this.slide_bar_width = 0; 931 if( this.slide_bar.attr('data-width') ){ 932 this.slide_bar_width = parseInt(this.slide_bar.attr('data-width')); 933 } 934 935 this.current_menu = this.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a'); 936 937 this.init(); 938 939 } // sassio_sf_menu 940 941 sassio_sf_menu.prototype = { 942 943 init: function(){ 944 945 var t = this; 946 947 // sf menu mod 948 t.sf_menu_mod(); 949 950 // init superfish menu 951 if(typeof($.fn.superfish) == 'function'){ 952 t.main_menu.superfish({ delay: 400, speed: 'fast' }); 953 954 t.sf_menu_position(); 955 $(window).resize(sassio_debounce(function(){ 956 t.sf_menu_position(); 957 }, 300)); 958 } 959 960 // init the slidebar 961 if( t.slide_bar.length > 0 ){ 962 t.init_slidebar(); 963 } 964 965 }, // init 966 967 sf_menu_mod: function(){ 968 969 // create the mega menu script 970 this.main_menu.find('.sf-mega > ul').each(function(){ 971 var mega_content = $('<div></div>'); 972 var mega_row = $('<div class="sf-mega-section-wrap" ></div>'); 973 var mega_column_size = 0; 974 975 $(this).children('li').each(function(){ 976 var column_size = parseInt($(this).attr('data-size')); 977 if( mega_column_size + column_size <= 60 ){ 978 mega_column_size += column_size; 979 }else{ 980 mega_column_size = column_size; 981 mega_content.append(mega_row); 982 mega_row = $('<div class="sf-mega-section-wrap" ></div>'); 983 } 984 985 mega_row.append( $('<div class="sf-mega-section" ></div>') 986 .addClass('sassio-column-' + column_size) 987 .html( $('<div class="sf-mega-section-inner" ></div>') 988 .addClass($(this).attr('class')) 989 .attr('id', $(this).attr('id')) 990 .html($(this).html()) 991 ) 992 ); 993 }); 994 995 mega_content.append(mega_row); 996 $(this).replaceWith(mega_content.html()); 997 }); 998 999 }, // sf_menu_mod 1000 1001 sf_menu_position: function(){ 1002 1003 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ) return; 1004 1005 // submenu of normal menu 1006 var body_wrapper = $('.sassio-body-wrapper'); 1007 var sub_normal_menu = this.main_menu.find('.sf-menu > li.sassio-normal-menu .sub-menu'); 1008 1009 sub_normal_menu.css({display: 'block'}).removeClass('sub-menu-right sub-menu-left'); 1010 sub_normal_menu.each(function(){ 1011 if( $(this).offset().left + $(this).width() > body_wrapper.outerWidth() ){ 1012 $(this).addClass('sub-menu-right'); 1013 }else if( $(this).offset().left < 0 ){ 1014 $(this).addClass('sub-menu-left'); 1015 } 1016 }); 1017 sub_normal_menu.css({display: 'none'}); 1018 1019 // submenu of mega menu 1020 this.main_menu.find('.sf-menu > li.sassio-mega-menu .sf-mega').each(function(){ 1021 if( !$(this).hasClass('sf-mega-full') ){ 1022 1023 $(this).css({ display: 'block' }); 1024 1025 // set the position 1026 $(this).css({ right: '', 'margin-left': -(($(this).width() - $(this).parent().outerWidth()) / 2) }); 1027 1028 // if exceed the screen 1029 if( $(this).offset().left < 0 ){ 1030 $(this).css({ left: 0, 'margin-left': '' }); 1031 }else if( $(this).offset().left + $(this).width() > $(window).width() ){ 1032 $(this).css({ right: 0, 'margin-left': '' }); 1033 } 1034 1035 $(this).css({ display: 'none' }); 1036 } 1037 1038 }); 1039 1040 }, // sf_menu_position 1041 1042 init_slidebar: function(){ 1043 1044 var t = this; 1045 1046 t.init_slidebar_pos(); 1047 $(window).on('load', function(){ t.init_slidebar_pos(); }); 1048 1049 // animate slidebar 1050 t.main_menu.children('.sf-menu').children('li').on({ 1051 mouseenter: function(){ 1052 var nav_element = $(this).children('a'); 1053 1054 if( nav_element.length > 0 ){ 1055 1056 if( t.slide_bar_width > 0 ){ 1057 var sbw = t.slide_bar_width; 1058 if( t.slide_bar.hasClass('sassio-left') ){ 1059 var sbl = nav_element.position().left - t.slide_bar_offset; 1060 }else{ 1061 var sbl = nav_element.position().left + ((nav_element.outerWidth() - sbw)/2) - t.slide_bar_offset; 1062 } 1063 }else{ 1064 var sbw = nav_element.outerWidth() + (2 * t.slide_bar_offset); 1065 var sbl = nav_element.position().left - t.slide_bar_offset; 1066 } 1067 1068 t.slide_bar.animate({ width: sbw, left: sbl }, { queue: false, duration: 250 }); 1069 } 1070 }, 1071 mouseleave: function(){ 1072 t.slide_bar.animate({ width: t.slide_bar_val.width, left: t.slide_bar_val.left }, { queue: false, duration: 250 }); 1073 } 1074 }); 1075 1076 // window resize event 1077 $(window).on('resize', function(){ t.init_slidebar_pos(); });
1078 $(window).on('sassio-navigation-slider-bar-init', function(){ 1079 t.current_menu = t.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a'); 1080 t.animate_slidebar_pos(); 1081 }); 1082 $(window).on('sassio-navigation-slider-bar-animate', function(){ t.animate_slidebar_pos(); }); 1083 1084 }, // init_slidebar 1085 1086 init_slidebar_pos: function(){ 1087 1088 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ) return; 1089 1090 var t = this; 1091 1092 if( t.current_menu.length > 0 ){ 1093 if( t.slide_bar_width > 0 ){ 1094 var sbw = t.slide_bar_width; 1095 if( t.slide_bar.hasClass('sassio-left') ){ 1096 var sbl = t.current_menu.position().left - t.slide_bar_offset; 1097 }else{ 1098 var sbl = t.current_menu.position().left + ((t.current_menu.outerWidth() - sbw)/2) - t.slide_bar_offset; 1099 } 1100 }else{ 1101 var sbw = t.current_menu.outerWidth() + (2 * t.slide_bar_offset); 1102 var sbl = t.current_menu.position().left - t.slide_bar_offset; 1103 } 1104 t.slide_bar_val = { width: sbw, left: sbl }; 1105 }else{ 1106 t.slide_bar_val = { width: 0 } 1107 1108 var first_child = t.main_menu.children('ul').children('li:first-child'); 1109 if( typeof(first_child.position()) != 'undefined' ){ 1110 t.slide_bar_val.left = first_child.position().left; 1111 }else{ 1112 t.slide_bar_val.left = 0; 1113 } 1114 } 1115 t.slide_bar.css({ width: t.slide_bar_val.width, left: t.slide_bar_val.left, display: 'block' }); 1116 1117 }, // set_slidebar_pos 1118 animate_slidebar_pos: function(){ 1119 1120 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ) return; 1121 1122 var t = this; 1123 1124 if( t.current_menu.length > 0 ){ 1125 if( t.slide_bar_width > 0 ){ 1126 var sbw = t.slide_bar_width; 1127 if( t.slide_bar.hasClass('sassio-left') ){ 1128 var sbl = t.current_menu.position().left - t.slide_bar_offset; 1129 }else{ 1130 var sbl = t.current_menu.position().left + ((t.current_menu.outerWidth() - sbw)/2) - t.slide_bar_offset ; 1131 } 1132 }else{ 1133 var sbw = t.current_menu.outerWidth() + (2 * t.slide_bar_offset); 1134 var sbl = t.current_menu.position().left - t.slide_bar_offset; 1135 } 1136 t.slide_bar_val = { width: sbw, left: sbl }; 1137 }else{ 1138 t.slide_bar_val = { width: 0 } 1139 1140 var first_child = t.main_menu.children('ul').children('li:first-child'); 1141 if( typeof(first_child.position()) != 'undefined' ){ 1142 t.slide_bar_val.left = first_child.position().left; 1143 }else{ 1144 t.slide_bar_val.left = 0; 1145 } 1146 } 1147 t.slide_bar.animate({ width: t.slide_bar_val.width, left: t.slide_bar_val.left }, { queue: false, duration: 250 }); 1148 1149 } // set_slidebar_pos 1150 1151 }; // sassio_sf_menu.prototype 1152 1153 ///////////////////////// 1154 // mobile menu 1155 ///////////////////////// 1156 $.fn.sassio_mobile_menu = function( args ){ 1157 1158 var menu_button = $(this).siblings('.sassio-mm-menu-button'); 1159 var options = { 1160 navbar: { title: '<span class="mmenu-custom-close" ></span>' }, 1161 extensions: [ 'pagedim-black' ], 1162 1163 }; 1164 var extensions = { 1165 offCanvas: { pageNodetype: '.sassio-body-outer-wrapper' } 1166 }; 1167 1168 // remove the wrap for submenu 1169 $(this).find('a[href="#"]').each(function(){ 1170 var content = $(this).html(); 1171 $('<span class="sassio-mm-menu-blank" ></span>').html(content).insertBefore($(this)); 1172 $(this).remove(); 1173 }); 1174 1175 if( $(this).attr('data-slide') ){ 1176 var html_class = 'sassio-mmenu-' + $(this).attr('data-slide'); 1177 $('html').addClass(html_class); 1178 1179 options.offCanvas = { position : $(this).attr('data-slide') }; 1180 } 1181 1182 $(this).mmenu(options, extensions); 1183 1184 var menu_api = $(this).data('mmenu'); 1185 $(this).find('a').not('.mm-next, .mm-prev').on('click', function(){ 1186 menu_api.close(); 1187 }); 1188 $(this).find('.mmenu-custom-close').on('click', function(){ 1189 menu_api.close(); 1190 }); 1191 $(window).resize(function(){ 1192 menu_api.close(); 1193 }); 1194 1195 // add class active to button 1196 menu_api.bind('open', function($panel){ 1197 menu_button.addClass('sassio-active'); 1198 }); 1199 menu_api.bind('close', function($panel){ 1200 menu_button.removeClass('sassio-active'); 1201 }); 1202 1203 } 1204 1205 ///////////////////////// 1206 // overlay menu 1207 ///////////////////////// 1208 var sassio_overlay_menu = function( menu ){ 1209 1210 this.menu = menu; 1211 this.menu_button = menu.children('.sassio-overlay-menu-icon'); 1212 this.menu_content = menu.children('.sassio-overlay-menu-content'); 1213 this.menu_close = this.menu_content.children('.sassio-overlay-menu-close'); 1214 1215 this.init(); 1216 } 1217 sassio_overlay_menu.prototype = { 1218 1219 init: function(){ 1220 1221 var t = this; 1222 1223 // add transition delay for each menu 1224 var delay_count = 0; 1225 t.menu_content.appendTo('body'); 1226 t.menu_content.find('ul.menu > li').each(function(){ 1227 $(this).css('transition-delay', (delay_count * 150) + 'ms'); 1228 1229 delay_count++; 1230 }); 1231
1232 // bind the menu button 1233 t.menu_button.on('click', function(){ 1234 $(this).addClass('sassio-active'); 1235 1236 t.menu_content.fadeIn(200, function(){ 1237 $(this).addClass('sassio-active'); 1238 }); 1239 1240 return false; 1241 }); 1242 1243 // bind the menu close button 1244 t.menu_close.on('click', function(){ 1245 t.menu_button.removeClass('sassio-active'); 1246 1247 t.menu_content.fadeOut(400, function(){ 1248 $(this).removeClass('sassio-active'); 1249 }); 1250 t.menu_content.find('.sub-menu').slideUp(200).removeClass('sassio-active'); 1251 1252 return false; 1253 }); 1254 1255 // menu item click 1256 t.menu_content.find('a').on('click', function(e){ 1257 var sub_menu = $(this).siblings('.sub-menu'); 1258 if( sub_menu.length > 0 ){ 1259 if( !sub_menu.hasClass('sassio-active') ){ 1260 var prev_active = sub_menu.closest('li').siblings().find('.sub-menu.sassio-active'); 1261 if( prev_active.length > 0 ){ 1262 prev_active.removeClass('sassio-active').slideUp(150); 1263 sub_menu.delay(150).slideDown(400, 'easeOutQuart').addClass('sassio-active'); 1264 }else{ 1265 sub_menu.slideDown(400, 'easeOutQuart').addClass('sassio-active'); 1266 } 1267 1268 $(this).addClass('sassio-no-preload'); 1269 return false; 1270 }else if( $(this).attr('href') == '#' ){ 1271 sub_menu.removeClass('sassio-active').slideUp(150); 1272 }else{ 1273 $(this).removeClass('sassio-no-preload'); 1274 } 1275 }else{ 1276 t.menu_close.trigger('click'); 1277 } 1278 }); 1279 1280 } 1281 1282 }; // sassio_overlay_menu.prototype 1283 1284 ///////////////////////// 1285 // header side navigation 1286 ///////////////////////// 1287 var sassio_header_side_nav = function( side_nav ){ 1288 1289 if( side_nav.length == 0 ) return; 1290 1291 this.prev_scroll = 0; 1292 1293 this.side_nav = side_nav; 1294 this.side_nav_content = side_nav.children(); 1295 1296 this.init(); 1297 1298 } // sassio_header_side_nav 1299 1300 sassio_header_side_nav.prototype = { 1301 1302 init: function(){ 1303 1304 var t = this; 1305 1306 t.init_nav_bar_element(); 1307 1308 $(window).resize(function(){ 1309 t.init_nav_bar_element(); 1310 }); 1311 1312 $(window).scroll(function(){ 1313 1314 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ) return; 1315 1316 // if content longer than screen height 1317 if( t.side_nav.hasClass('sassio-allow-slide') ){ 1318 1319 var admin_bar_height = parseInt($('html').css('margin-top')); 1320 var scroll_down = ($(window).scrollTop() > t.prev_scroll); 1321 t.prev_scroll = $(window).scrollTop(); 1322 1323 // if scroll down 1324 if( scroll_down ){ 1325 1326 if( !t.side_nav.hasClass('sassio-fix-bottom') ){ 1327 if( t.side_nav.hasClass('sassio-fix-top') ){ 1328 t.side_nav.css('top', t.side_nav.offset().top); 1329 t.side_nav.removeClass('sassio-fix-top'); 1330 1331 }else if( $(window).height() + $(window).scrollTop() > t.side_nav_content.offset().top + t.side_nav_content.outerHeight() ){ 1332 if( !t.side_nav.hasClass('sassio-fix-bottom') ){ 1333 t.side_nav.addClass('sassio-fix-bottom'); 1334 t.side_nav.css('top', ''); 1335 } 1336 } 1337 } 1338 1339 // if scroll up 1340 }else{ 1341 1342 if( !t.side_nav.hasClass('sassio-fix-top') ){ 1343 if( t.side_nav.hasClass('sassio-fix-bottom') ){ 1344 var top_pos = $(window).scrollTop() + ($(window).height() - admin_bar_height) - t.side_nav_content.outerHeight(); 1345 t.side_nav.css('top', top_pos); 1346 t.side_nav.removeClass('sassio-fix-bottom'); 1347 1348 }else if( $(window).scrollTop() + admin_bar_height < t.side_nav_content.offset().top ){ 1349 if( !t.side_nav.hasClass('sassio-fix-top') ){ 1350 t.side_nav.addClass('sassio-fix-top'); 1351 t.side_nav.css('top', ''); 1352 } 1353 } 1354 } 1355 1356 } 1357 1358 } 1359 }); 1360 1361 }, 1362 1363 init_nav_bar_element: function(){ 1364 1365 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ) return; 1366 1367 var t = this; 1368 var middle_pos = t.side_nav_content.children('.sassio-pos-middle').addClass('sassio-active'); 1369 var bottom_pos = t.side_nav_content.children('.sassio-pos-bottom').addClass('sassio-active'); 1370 1371 // remove all additional space 1372 t.side_nav_content.children('.sassio-pre-spaces').remove(); 1373 1374 // add class depends on the screen size/content 1375 if( $(window).height() < t.side_nav_content.height() ){ 1376 t.side_nav.addClass('sassio-allow-slide'); 1377 }else{ 1378 t.side_nav.removeClass('sassio-allow-slide sassio-fix-top sassio-fix-bottom').css('top', ''); 1379 1380 // set the middle position 1381 if( t.side_nav.hasClass('sassio-style-middle') ){ 1382 middle_pos.each(function(){ 1383 var top_padding = parseInt($(this).css('padding-top')); 1384 var prespace = ((t.side_nav.height() - (t.side_nav_content.height() - top_padding)) / 2) - top_padding; 1385 1386 if( prespace > 0 ){ 1387 $('<div class="sassio-pre-spaces" ></div>').css('height', prespace).insertBefore($(this)); 1388 } 1389 });
1390 } 1391 1392 // set the bottom position 1393 bottom_pos.each(function(){ 1394 var prespace = t.side_nav.height() - t.side_nav_content.height(); 1395 1396 if( prespace > 0 ){ 1397 $('<div class="sassio-pre-spaces" ></div>').css('height', prespace).insertBefore($(this)); 1398 } 1399 }); 1400 1401 } 1402 } 1403 1404 }; // sassio_sf_menu.prototype 1405 1406 ///////////////////////// 1407 // anchoring 1408 ///////////////////////// 1409 1410 var sassio_anchor = function(){ 1411 1412 this.anchor_link = $('a[href*="#"]').not('[href="#"]').filter(function(){ 1413 1414 // for mm-menu plugin 1415 if( $(this).is('.sassio-mm-menu-button, .mm-next, .mm-prev, .mm-title, .gdlr-core-ilightbox') ){ 1416 return false; 1417 } 1418 1419 // for google review plugin 1420 if( $(this).is('') ){ 1421 return false; 1422 } 1423 1424 // for additional plugins 1425 if( $(this).is('#cancel-comment-reply-link, .comment-reply-link, .fbx-btn-transition, .ti-header') ) { 1426 return false; 1427 }else if( $(this).parent('.clearButton').length ){ 1428 return false; 1429 } 1430 1431 // for woocommerce 1432 if( $(this).parent('.description_tab, .reviews_tab').length || $(this).not('[class^="sassio"]').closest('.woocommerce').length ){ 1433 if( !$(this).closest('.menu-item').length ){ 1434 return false; 1435 } 1436 } 1437 1438 return true; 1439 }); 1440 1441 if( this.anchor_link.length || window.location.hash.length ){ 1442 this.menu_anchor = $('#sassio-main-menu, #sassio-bullet-anchor'); 1443 this.home_anchor = this.menu_anchor.find('ul.sf-menu > li.current-menu-item > a, ul.sf-menu > li.current-menu-ancestor > a, .sassio-bullet-anchor-link.current-menu-item'); 1444 1445 this.init(); 1446 } 1447 } 1448 sassio_anchor.prototype = { 1449 1450 init: function(){ 1451 1452 var t = this; 1453 1454 t.animate_anchor(); 1455 t.scroll_section(); 1456 1457 // init bullet anchor height 1458 t.menu_anchor.filter('#sassio-bullet-anchor').each(function(){ 1459 $(this).css('margin-top', - t.menu_anchor.height() / 2).addClass('sassio-init'); 1460 }); 1461 1462 // initialize if the page hash exists 1463 // wait for all element to initialize ( eg. flexslider ) 1464 var url_hash = window.location.hash; 1465 if( url_hash ){ 1466 setTimeout(function(){ 1467 1468 var current_menu = t.menu_anchor.find('a[href*="' + url_hash + '"]'); 1469 if( !current_menu.is('.current-menu-item, .current-menu-ancestor') ){ 1470 current_menu.addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor'); 1471 1472 $(window).trigger('sassio-navigation-slider-bar-init'); 1473 } 1474 1475 t.scroll_to(url_hash, false, 300); 1476 }, 500); 1477 } 1478 1479 }, 1480 1481 animate_anchor: function(){ 1482 1483 var t = this; 1484 1485 // home anchor 1486 t.home_anchor.on('click', function(){ 1487 1488 if( window.location.href == this.href ){ 1489 $('html, body').animate({ scrollTop: 0 }, { duration: 1500, easing: 'easeOutQuart' }); 1490 return false; 1491 } 1492 1493 }); 1494 1495 // normal anchor 1496 t.anchor_link.on('click', function() { 1497 if( location.hostname == this.hostname && location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') ){ 1498 if( $(this).closest('#sassio-main-menu').length ){ 1499 $(this).parent().addClass('current-menu-item').siblings().removeClass('current-menu-item'); 1500 $(window).trigger('sassio-navigation-slider-bar-init'); 1501 } 1502 return t.scroll_to(this.hash, true); 1503 } 1504 }); 1505 1506 }, // animate anchor 1507 1508 scroll_to: function( hash, redirect, duration ){ 1509 1510 // start scrolling 1511 if( hash == '#sassio-top-anchor' ){ 1512 var scroll_position = 0; 1513 }else{ 1514 1515 var target = $(hash); 1516 1517 if( target.length ){ 1518 var scroll_position = target.offset().top; 1519 } 1520 } 1521 1522 if( typeof(scroll_position) != 'undefined' ){ 1523 1524 // offset for wordpress admin bar 1525 scroll_position = scroll_position - parseInt($('html').css('margin-top')); 1526 1527 // offset for fixed nav bar 1528 if( sassio_display == 'mobile-portrait' || sassio_display == 'mobile-landscape' ){ 1529 scroll_position = scroll_position - 75; 1530 }else if( typeof(window.sassio_anchor_offset) != 'undefined' && !isNaN(window.sassio_anchor_offset) ){ 1531 scroll_position = scroll_position - parseInt(window.sassio_anchor_offset); 1532 } 1533 1534 if( scroll_position < 0 ) scroll_position = 0; 1535 1536 $(window).trigger('sassio-anchor-animate'); 1537 $('html, body').animate({ scrollTop: scroll_position }, { duration: 1500, easing: 'easeOutQuart', queue: false }); 1538 1539 return false; 1540 1541 }else if( redirect ){ 1542 1543 window.location.href = $('body').attr('data-home-url') + hash; 1544 1545 return false; 1546 } 1547 1548 }, // scroll to 1549 1550 scroll_section: function(){ 1551 1552 var t = this; 1553 1554 // have anchor in anchor menu 1555 var menu_link_anchor = this.menu_anchor.find('a[href*="#"]').not('[href="#"]'); 1556 if( !menu_link_anchor.length ){ return; } 1557 1558 // get anchor section 1559 var home_anchor_section = $('#sassio-page-wrapper'); 1560 var anchor_section = home_anchor_section.find('div[id], section[id]'); 1561 if( !anchor_section.length ){ return; } 1562 1563 // add data for faster query 1564 menu_link_anchor.each(function(){ 1565 if( $(this).closest('.sub-menu').length == 0 && $(this.hash).length ){ 1566 $(this).attr('data-anchor', this.hash); 1567 } 1568 }); 1569 1570 // check section on scroll event 1571 $(window).scroll(function(){ 1572 1573 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ) return; 1574 1575 if( t.home_anchor.length && $(window).scrollTop() <= home_anchor_section.offset().top ){ 1576 1577 t.home_anchor.each(function(){ 1578 if( $(this).hasClass('sassio-bullet-anchor-link') ){ 1579 $(this).addClass('current-menu-item').siblings().removeClass('current-menu-item'); 1580 $(this).parent('.sassio-bullet-anchor').attr('data-anchor-section', 'sassio-home'); 1581 }else if( !$(this).parent('.current-menu-item, .current-menu-ancestor').length ){ 1582 $(this).parent().addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor');
1583 $(window).trigger('sassio-navigation-slider-bar-init'); 1584 } 1585 }); 1586 1587 }else{ 1588 var section_position = $(window).scrollTop() + ($(window).height() / 2); 1589 1590 anchor_section.each(function(){ 1591 if( $(this).css('display') == 'none' ) return; 1592 1593 var top_offset_pos = $(this).offset().top; 1594 1595 if( (section_position > top_offset_pos) && (section_position < top_offset_pos + $(this).outerHeight()) ){ 1596 var section_id = $(this).attr('id'); 1597 menu_link_anchor.filter('[data-anchor="#' + section_id + '"]').each(function(){ 1598 if( $(this).hasClass('sassio-bullet-anchor-link') ){ 1599 $(this).addClass('current-menu-item').siblings().removeClass('current-menu-item'); 1600 $(this).parent('.sassio-bullet-anchor').attr('data-anchor-section', section_id); 1601 }else if( $(this).parent('li.menu-item').length && !$(this).parent('li.menu-item').is('.current-menu-item, .current-menu-ancestor') ){ 1602 $(this).parent('li.menu-item').addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor'); 1603 $(window).trigger('sassio-navigation-slider-bar-init'); 1604 } 1605 }); 1606 1607 return false; 1608 } 1609 1610 }); 1611 } 1612 1613 }); 1614 1615 } // scroll section 1616 1617 }; 1618 1619 var sassio_sticky_navigation = function(){ 1620 1621 var t = this; 1622 1623 // get navigation 1624 t.sticky_nav = $('.sassio-with-sticky-navigation .sassio-sticky-navigation'); 1625 t.mobile_menu = $('#sassio-mobile-header'); 1626 1627 // set the anchor offset 1628 if( t.sticky_nav.hasClass('sassio-sticky-navigation-height') ){ 1629 window.sassio_anchor_offset = t.sticky_nav.outerHeight(); 1630 $(window).resize(function(){ 1631 window.sassio_anchor_offset = t.sticky_nav.outerHeight(); 1632 }); 1633 }else if( t.sticky_nav.attr('data-navigation-offset') ){ 1634 window.sassio_anchor_offset = parseInt(t.sticky_nav.attr('data-navigation-offset')); 1635 }else if( t.sticky_nav.length ){ 1636 window.sassio_anchor_offset = 75; 1637 } 1638 1639 // init the sticky navigation 1640 if( t.sticky_nav.length ){ 1641 t.init(); 1642 } 1643 1644 if( t.mobile_menu.hasClass('sassio-sticky-mobile-navigation') ){ 1645 t.style_mobile_slide(); 1646 $(window).trigger('sassio-set-sticky-mobile-navigation'); 1647 } 1648 1649 } 1650 sassio_sticky_navigation.prototype = { 1651 1652 init: function(){ 1653 1654 var t = this; 1655 1656 if( t.sticky_nav.hasClass('sassio-style-fixed') ){ 1657 t.style_fixed(); 1658 }else if( t.sticky_nav.hasClass('sassio-style-slide') ){ 1659 t.style_slide(); 1660 } 1661 1662 $(window).trigger('sassio-set-sticky-navigation'); 1663 }, 1664 1665 style_fixed: function(){ 1666 1667 var t = this; 1668 var placeholder = $('<div class="sassio-sticky-menu-placeholder" ></div>'); 1669 1670 $(window).on('scroll sassio-set-sticky-navigation', function(){ 1671 1672 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ) return; 1673 1674 var page_offset = parseInt($('html').css('margin-top')); 1675 1676 if( !t.sticky_nav.hasClass('sassio-fixed-navigation') ){ 1677 1678 if( $(window).scrollTop() + page_offset > t.sticky_nav.offset().top ){ 1679 if( !t.sticky_nav.hasClass('sassio-without-placeholder') ){ 1680 placeholder.height(t.sticky_nav.outerHeight()); 1681 } 1682 placeholder.insertAfter(t.sticky_nav); 1683 $('body').append(t.sticky_nav); 1684 t.sticky_nav.addClass('sassio-fixed-navigation'); 1685 1686 setTimeout(function(){ t.sticky_nav.addClass('sassio-animate-fixed-navigation'); }, 10); 1687 setTimeout(function(){ 1688 t.sticky_nav.css('height', ''); 1689 $(window).trigger('sassio-navigation-slider-bar-animate'); 1690 }, 200); 1691 } 1692 }else{ 1693 1694 if( $(window).scrollTop() + page_offset <= placeholder.offset().top ){ 1695 if( !t.sticky_nav.hasClass('sassio-without-placeholder') ){ 1696 t.sticky_nav.height(placeholder.height()); 1697 } 1698 t.sticky_nav.insertBefore(placeholder); 1699 t.sticky_nav.removeClass('sassio-fixed-navigation'); 1700 placeholder.remove(); 1701 1702 setTimeout(function(){ t.sticky_nav.removeClass('sassio-animate-fixed-navigation'); }, 10); 1703 setTimeout(function(){ 1704 t.sticky_nav.css('height', '');
1705 $(window).trigger('sassio-navigation-slider-bar-animate'); 1706 }, 200); 1707 } 1708 } 1709 }); 1710 1711 }, // style_fixed 1712 1713 style_slide: function(){ 1714 1715 var t = this; 1716 var placeholder = $('<div class="sassio-sticky-menu-placeholder" ></div>'); 1717 1718 $(window).on('scroll sassio-set-sticky-navigation', function(){ 1719 1720 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ){ return; } 1721 1722 var page_offset = parseInt($('html').css('margin-top')); 1723 1724 if( !t.sticky_nav.hasClass('sassio-fixed-navigation') ){ 1725 1726 if( $(window).scrollTop() + page_offset > t.sticky_nav.offset().top + t.sticky_nav.outerHeight() + 200 ){ 1727 1728 if( !t.sticky_nav.hasClass('sassio-without-placeholder') ){ 1729 placeholder.height(t.sticky_nav.outerHeight()); 1730 } 1731 placeholder.insertAfter(t.sticky_nav); 1732 t.sticky_nav.css('display', 'none'); 1733 1734 $('body').append(t.sticky_nav); 1735 t.sticky_nav.addClass('sassio-fixed-navigation sassio-animate-fixed-navigation'); 1736 t.sticky_nav.slideDown(200); 1737 $(window).trigger('sassio-navigation-slider-bar-animate'); 1738 } 1739 }else{ 1740 1741 if( $(window).scrollTop() + page_offset <= placeholder.offset().top + placeholder.height() + 200 ){ 1742 var clone = t.sticky_nav.clone(); 1743 clone.insertAfter(t.sticky_nav); 1744 clone.slideUp(200, function(){ $(this).remove(); }); 1745 1746 t.sticky_nav.insertBefore(placeholder); 1747 placeholder.remove(); 1748 t.sticky_nav.removeClass('sassio-fixed-navigation sassio-animate-fixed-navigation'); 1749 t.sticky_nav.css('display', 'block'); 1750 1751 $(window).trigger('sassio-navigation-slider-bar-animate'); 1752 } 1753 } 1754 }); 1755 1756 }, // style_slide 1757 1758 style_mobile_slide: function(){ 1759 1760 var t = this; 1761 var placeholder = $('<div class="sassio-sticky-mobile-placeholder" ></div>'); 1762 1763 $(window).on('scroll sassio-set-sticky-mobile-navigation', function(){ 1764 1765 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' || sassio_display == 'tablet' ){ 1766 1767 var page_offset = parseInt($('html').css('margin-top')); 1768 1769 if( !t.mobile_menu.hasClass('sassio-fixed-navigation') ){ 1770 if( $(window).scrollTop() + page_offset > t.mobile_menu.offset().top + t.mobile_menu.outerHeight() + 200 ){ 1771 placeholder.height(t.mobile_menu.outerHeight()).insertAfter(t.mobile_menu); 1772 $('body').append(t.mobile_menu); 1773 t.mobile_menu.addClass('sassio-fixed-navigation'); 1774 t.mobile_menu.css('display', 'none').slideDown(200); 1775 } 1776 }else{ 1777 if( $(window).scrollTop() + page_offset <= placeholder.offset().top + placeholder.height() + 200 ){ 1778 var clone = t.mobile_menu.clone(); 1779 clone.insertAfter(t.mobile_menu); 1780 clone.slideUp(200, function(){ $(this).remove(); }); 1781 1782 t.mobile_menu.insertBefore(placeholder); 1783 placeholder.remove(); 1784 t.mobile_menu.removeClass('sassio-fixed-navigation'); 1785 t.mobile_menu.css('display', 'block'); 1786 } 1787 } 1788 } 1789 1790 }); 1791 1792 }, // style_slide 1793 1794 }; 1795 1796 var sassio_font_resize = function(){ 1797 1798 this.heading_font = $('h1, h2, h3, h4, h5, h6'); 1799 1800 this.init(); 1801 1802 } 1803 sassio_font_resize.prototype = { 1804 1805 init: function(){ 1806 1807 var t = this; 1808 1809 t.resize(); 1810 $(window).on('resize', sassio_throttling(function(){ 1811 t.resize(); 1812 }, 100)); 1813 1814 }, 1815 1816 resize: function(){ 1817 1818 var t = this; 1819 1820 if( sassio_display == 'mobile-landscape' || sassio_display == 'mobile-portrait' ){ 1821 1822 t.heading_font.each(function(){ 1823 if( parseInt($(this).css('font-size')) > 40 ){ 1824 if( !$(this).attr('data-orig-font') ){ 1825 $(this).attr('data-orig-font', $(this).css('font-size')); 1826 } 1827 1828 $(this).css('font-size', '40px'); 1829 } 1830 }); 1831 1832 // return font to normal 1833 }else{ 1834 1835 t.heading_font.filter('[data-orig-font]').each(function(){ 1836 $(this).css('font-size', $(this).attr('data-orig-font')); 1837 }); 1838 1839 } 1840 } 1841 1842 }; 1843 1844 // tourmaster lightbox 1845 function sassio_lightbox( content ){ 1846 1847 var lightbox_wrap = $('<div class="sassio-lightbox-wrapper" ></div>').hide(); 1848 var lightbox_content_wrap = $('<div class="sassio-lightbox-content-cell" ></div>'); 1849 lightbox_wrap.append(lightbox_content_wrap); 1850 lightbox_content_wrap.wrap($('<div class="sassio-lightbox-content-row" ></div>')); 1851 1852 lightbox_content_wrap.append(content); 1853 1854 var scrollPos = $(window).scrollTop(); 1855 $('html').addClass('sassio-lightbox-on'); 1856 $('body').append(lightbox_wrap); 1857 lightbox_wrap.fadeIn(300); 1858 1859 // do a lightbox action 1860 lightbox_wrap.on('click', '.sassio-lightbox-close', function(){ 1861 $('html').removeClass('sassio-lightbox-on'); 1862 $(window).scrollTop(scrollPos); 1863 lightbox_wrap.fadeOut(300, function(){ 1864 $(this).remove(); 1865 }); 1866 }); 1867 1868 } // sassio_lightbox 1869 1870 //////////////////////////////// 1871 // starting running the script 1872 //////////////////////////////// 1873 $(document).ready(function(){ 1874 1875 // resize font on mobile 1876 new sassio_font_resize(); 1877 1878 // init main navigation menu 1879 $('#sassio-main-menu, #sassio-right-menu, #sassio-mobile-menu, #sassio-top-bar-menu').each(function(){ 1880 if( $(this).hasClass('sassio-overlay-menu') ){ 1881 new sassio_overlay_menu( $(this) ); 1882 }else if( $(this).hasClass('sassio-mm-menu-wrap') ){ 1883 $(this).sassio_mobile_menu(); 1884 }else{ 1885 new sassio_sf_menu( $(this) ); 1886 } 1887 }); 1888 1889 const cursor = document.querySelector(".js-cursor"); 1890 1891 if (cursor !== null ) { 1892 1893 window.App = {}; 1894 1895 App.config = { 1896 cursorFollower: { 1897 enabled: true, 1898 disableBreakpoint: '992', // cursor will be disabled on this device width 1899 }, 1900 } 1901 1902 App.html = document.querySelector('html'); 1903 App.body = document.querySelector('body'); 1904 1905 let follower; 1906 let label; 1907 let icon; 1908 1909 let clientX; 1910 let clientY; 1911 let cursorWidth; 1912 let cursorHeight; 1913 let cursorTriggers; 1914 let state; 1915 1916 function variables() { 1917 follower = cursor.querySelector(".js-follower");
1918 label = cursor.querySelector(".js-label"); 1919 icon = cursor.querySelector(".js-icon"); 1920 clientX = -100; 1921 clientY = -100; 1922 cursorWidth = cursor.offsetWidth / 2; 1923 cursorHeight = cursor.offsetHeight / 2; 1924 cursorTriggers; 1925 state = false; 1926 } 1927 1928 function enterHandler({ target }) { 1929 1930 cursor.classList.add('is-active'); 1931 1932 if (target.getAttribute('data-cursor-label')) { 1933 App.body.classList.add('is-cursor-active'); 1934 cursor.classList.add('has-label'); 1935 label.innerHTML = target.getAttribute('data-cursor-label'); 1936 } 1937 1938 if (target.getAttribute('data-cursor-label-light')) { 1939 App.body.classList.add('is-cursor-active'); 1940 cursor.classList.add('has-label-light'); 1941 label.innerHTML = target.getAttribute('data-cursor-label-light'); 1942 } 1943 1944 if (target.getAttribute('data-cursor-icon')) { 1945 App.body.classList.add('is-cursor-active'); 1946 cursor.classList.add('has-icon'); 1947 const iconAttr = target.getAttribute('data-cursor-icon'); 1948 icon.innerHTML = feather.icons[iconAttr].toSvg(); 1949 } 1950 1951 if (target.getAttribute('data-cursor-slider')) { 1952 App.body.classList.add('is-cursor-active'); 1953 cursor.classList.add('has-slider-icon'); 1954 } 1955 } 1956 1957 function leaveHandler() { 1958 1959 App.body.classList.remove('is-cursor-active'); 1960 cursor.classList.remove('is-active'); 1961 cursor.classList.remove('has-label'); 1962 cursor.classList.remove('has-label-light'); 1963 cursor.classList.remove('has-icon'); 1964 cursor.classList.remove('has-slider-icon'); 1965 label.innerHTML = ''; 1966 icon.innerHTML = ''; 1967 } 1968 1969 function update() { 1970 1971 if (!cursor) return; 1972 1973 cursorTriggers = document.querySelectorAll([ 1974 "button", 1975 "a", 1976 "input", 1977 "[data-cursor]", 1978 "[data-cursor-label]", 1979 "[data-cursor-label-light]", 1980 "[data-cursor-icon]", 1981 "[data-cursor-slider]", 1982 "textarea" 1983 ]); 1984 1985 cursorTriggers.forEach(el => { 1986 el.addEventListener("mouseenter", enterHandler); 1987 el.addEventListener("mouseleave", leaveHandler); 1988 }); 1989 1990 } 1991 1992 function clear() { 1993 1994 if (!cursor) return; 1995 1996 cursorTriggers.forEach(el => { 1997 el.removeEventListener("mouseenter", enterHandler); 1998 el.removeEventListener("mouseleave", leaveHandler); 1999 }); 2000 2001 } 2002 2003 function hide() { 2004 2005 if (!cursor) return; 2006 cursor.classList.add('is-hidden'); 2007 2008 } 2009 2010 function show() { 2011 2012 if (!cursor) return; 2013 cursor.classList.remove('is-hidden'); 2014 2015 } 2016 2017 function breakpoint() { 2018 2019 if (!state) return; 2020 if (!App.config.cursorFollower.disableBreakpoint) return; 2021 2022 let width = (window.innerWidth > 0) ? window.innerWidth : screen.width; 2023 2024 if (width < App.config.cursorFollower.disableBreakpoint) { 2025 state = false; 2026 cursor.classList.remove('is-enabled'); 2027 clear(); 2028 } else { 2029 state = true; 2030 cursor.classList.add('is-enabled'); 2031 update(); 2032 } 2033 2034 window.addEventListener('resize', () => { 2035 let width = (window.innerWidth > 0) ? window.innerWidth : screen.width; 2036 2037 if (width < App.config.cursorFollower.disableBreakpoint) { 2038 state = false; 2039 cursor.classList.remove('is-enabled'); 2040 clear(); 2041 } else { 2042 state = true; 2043 cursor.classList.add('is-enabled'); 2044 update(); 2045 } 2046 }) 2047 2048 } 2049 2050 variables(); 2051 state = true; 2052 cursor.classList.add('is-enabled'); 2053 2054 document.addEventListener("mousedown", e => { 2055 cursor.classList.add('is-mouse-down'); 2056 }); 2057 2058 document.addEventListener("mouseup", e => { 2059 cursor.classList.remove('is-mouse-down'); 2060 }); 2061 2062 document.addEventListener("mousemove", (event) => { 2063 clientX = event.clientX; 2064 clientY = event.clientY; 2065 }); 2066 2067 const render = () => { 2068 cursor.style.transform = `translate(${clientX - cursorWidth}px, ${clientY - cursorHeight}px)`; 2069 requestAnimationFrame(render); 2070 }; 2071 2072 requestAnimationFrame(render); 2073 2074 update(); 2075 breakpoint(); 2076 } 2077 2078 $('#sassio-top-search, #sassio-mobile-top-search').each(function(){ 2079 2080 var search_wrap = $(this).siblings('.sassio-top-search-wrap'); 2081 search_wrap.appendTo('body'); 2082
2083 // bind click button 2084 $(this).on('click', function(){ 2085 search_wrap.fadeIn(200, function(){ 2086 $(this).addClass('sassio-active'); 2087 }); 2088 }); 2089 2090 // bind close button 2091 search_wrap.find('.sassio-top-search-close').on('click', function(){ 2092 search_wrap.fadeOut(200, function(){ 2093 $(this).addClass('sassio-active'); 2094 }); 2095 }); 2096 2097 // bind search button 2098 search_wrap.find('.search-submit').on('click', function(){ 2099 if( search_wrap.find('.search-field').val().length == 0 ){ 2100 return false; 2101 } 2102 }); 2103 }); 2104 2105 $('#sassio-main-menu-cart, #sassio-mobile-menu-cart').each(function(){ 2106 2107 $(this).on({ 2108 mouseenter: function(){ 2109 $(this).addClass('sassio-active sassio-animating'); 2110 }, 2111 mouseleave: function(){ 2112 var menu_cart = $(this); 2113 menu_cart.removeClass('sassio-active'); 2114 setTimeout(function(){ 2115 menu_cart.removeClass('sassio-animating'); 2116 }, 400) 2117 } 2118 }); 2119 }); 2120 2121 // woocommerce top bar cart 2122 if( typeof(wc_add_to_cart_params) != 'undefined' ){ 2123 $('body').on('added_to_cart', function(){ 2124 $.ajax({
2125 type: 'POST', 2126 url: wc_add_to_cart_params.ajax_url, 2127 data: { 'action': 'top_bar_woocommerce_cart' }, 2128 dataType: 'json', 2129 error: function(jqXHR, textStatus, errorThrown){ 2130 console.log(jqXHR, textStatus, errorThrown); 2131 }, 2132 success: function(data){ 2133 if( typeof(data['title']) != 'undefined' ){ 2134 $('.sassio-top-cart-title').replaceWith(data['title']); 2135 } 2136 if( typeof(data['cart-items']) != 'undefined' ){ 2137 $('.sassio-top-cart-item-wrap').replaceWith(data['cart-items']); 2138 } 2139 } 2140 }); 2141 }); 2142 } 2143 2144 2145 // sassio 2146 $('#sassio-dropdown-sassio-flag').hover(function(){ 2147 $(this).children('.sassio-dropdown-sassio-list').fadeIn(200); 2148 }, function(){ 2149 $(this).children('.sassio-dropdown-sassio-list').fadeOut(200); 2150 }); 2151 2152 // additional space for header transparent 2153 $('.sassio-header-boxed-wrap, .sassio-header-background-transparent, .sassio-navigation-bar-wrap.sassio-style-transparent').each(function(){ 2154 var header_transparent = $(this); 2155 var header_transparent_sub = $('.sassio-header-transparent-substitute'); 2156 2157 header_transparent_sub.height(header_transparent.outerHeight()); 2158 $(window).on('load resize', function(){ 2159 header_transparent_sub.height(header_transparent.outerHeight()); 2160 }); 2161 }); 2162 2163 // full screen for 404 not found 2164 $('body.error404, body.search-no-results').each(function(){ 2165 2166 var wrap = $(this).find('#sassio-full-no-header-wrap'); 2167 var body_wrap_offset = parseInt($(this).children('.sassio-body-outer-wrapper').children('.sassio-body-wrapper').css('margin-bottom')); 2168 2169 var padding = ($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2; 2170 if( padding > 0 ){ 2171 wrap.css({ 'padding-top': padding, 'padding-bottom': padding }); 2172 } 2173 2174 $(window).on('load resize', function(){ 2175 wrap.css({ 'padding-top': 0, 'padding-bottom': 0 }); 2176 padding = ($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2; 2177 if( padding > 0 ){ 2178 wrap.css({ 'padding-top': padding, 'padding-bottom': padding }); 2179 } 2180 }); 2181 }); 2182 2183 // back to top button 2184 var back_to_top = $('#sassio-footer-back-to-top-button'); 2185 if( back_to_top.length ){ 2186 $(window).on('scroll', function(){ 2187 if( $(window).scrollTop() > 300 ){ 2188 back_to_top.addClass('sassio-scrolled'); 2189 }else{ 2190 back_to_top.removeClass('sassio-scrolled'); 2191 } 2192 }); 2193 } 2194 2195 // page preload 2196 $('body').children('#sassio-page-preload').each(function(){ 2197 var page_preload = $(this); 2198 var animation_time = parseInt(page_preload.attr('data-animation-time')); 2199 2200 $('a[href]').not('[href^="#"], [href^="mailto:"], [target="_blank"], .gdlr-core-js, .strip, .sf-with-ul, .remove, .ajax_add_to_cart, .comment-reply-link').on('click', function(e){ 2201 if( e.which != 1 || $(this).hasClass('sassio-no-preload') || e.ctrlKey || e.metaKey ) return; 2202 2203 if( $(this).closest('.modula').length ) return; 2204 2205 if( $(this).prop("hash") && $($(this).prop("hash")).length ) return; 2206 2207 if( window.location.href != this.href ){ 2208 page_preload.addClass('sassio-out').fadeIn(animation_time); 2209 } 2210 }); 2211 2212 $(window).on('load', function(){ 2213 page_preload.fadeOut(animation_time); 2214 }); 2215 }); 2216 2217 // single nav style 2 sync height 2218 $('body.sassio-blog-style-2 .sassio-single-nav-area').each(function(){ 2219 var max_height; 2220 var single_nav_2 = $(this).children(); 2221 2222 max_height = 0; 2223 single_nav_2.css('min-height', '0px'); 2224 single_nav_2.each(function(){ 2225 if( max_height < $(this).outerHeight() ){ 2226 max_height = $(this).outerHeight(); 2227 } 2228 }); 2229 single_nav_2.css('min-height', max_height); 2230 2231 $(window).resize(function(){ 2232 max_height = 0; 2233 single_nav_2.css('min-height', '0px'); 2234 single_nav_2.each(function(){ 2235 if( max_height < $(this).outerHeight() ){ 2236 max_height = $(this).outerHeight(); 2237 } 2238 }); 2239 single_nav_2.css('min-height', max_height); 2240 }); 2241 }); 2242 2243 // lightbox popup 2244 $('[data-sassio-lb]').click(function(){ 2245 var lb_content = $(this).siblings('[data-sassio-lb-id="' + $(this).attr('data-sassio-lb') + '"]'); 2246 sassio_lightbox(lb_content.clone()); 2247 }); 2248 2249 // float social 2250 $('#sassio-float-social').each(function(){ 2251 var float_social_item = $(this);
2252 var pb_body = $('.gdlr-core-page-builder-body'); 2253 2254 var footer = $('footer'); 2255 var content_area = $('.sassio-page-wrapper'); 2256 var content_offset = 0; 2257 content_offset += parseInt($('html').css('margin-top')); 2258 2259 $(window).on('scroll float-social', function(){ 2260 2261 2262 // display 2263 if( float_social_item.hasClass('sassio-display-after-title') ){ 2264 var blog_offset = 0; 2265 content_area.children('.sassio-blog-title-wrap').each(function(){ blog_offset = $(this).outerHeight(); }); 2266 2267 if( float_social_item.offset().top >= content_area.offset().top + blog_offset - content_offset ){ 2268 float_social_item.animate({'opacity': 1}, {duration: 100, queue: false}); 2269 }else{ 2270 float_social_item.animate({'opacity': 0}, {duration: 100, queue: false}); 2271 } 2272 } 2273 2274 // section 2275 var section = ''; 2276 var fs_pos = $(window).scrollTop() + $(window).height() / 2; 2277 2278 if( fs_pos > footer.offset().top ){ 2279 section = 'footer'; 2280 }else{ 2281 pb_body.children().each(function(){ 2282 if( !$(this).attr('data-float-social') ) return; 2283 2284 if( fs_pos > $(this).offset().top && fs_pos < $(this).offset().top + $(this).outerHeight() ){ 2285 section = $(this).attr('data-float-social'); 2286 } 2287 }); 2288 } 2289 2290 float_social_item.attr('data-section', section); 2291 }); 2292 $(window).on('load', function(){ 2293 $(window).trigger('float-social'); 2294 }); 2295 }); 2296 2297 // side content menu 2298 $('#sassio-side-content-menu').each(function(){ 2299 2300 var side_content_menu = $(this); 2301 var menu_button = $('.sassio-side-content-menu-button'); 2302 menu_button.on('click', function(){ 2303 side_content_menu.fadeIn(300); 2304 side_content_menu.addClass('sassio-active'); 2305 }); 2306 side_content_menu.on('click', '.sassio-side-content-menu-close', function(){ 2307 side_content_menu.removeClass('sassio-active'); 2308 side_content_menu.fadeOut(300); 2309 }); 2310 2311 }); 2312 2313 }); 2314 2315 // fix back button for preload 2316 $(window).on('pageshow', function(event) { 2317 $('body').children('#sassio-page-preload').each(function(){ 2318 $(this).fadeOut(400); 2319 }); 2320 }); 2321 2322 $(window).on('load', function(){ 2323
2324 // fixed footer 2325 $('#sassio-fixed-footer').each(function(){ 2326 var fixed_footer = $(this); 2327 var placeholder = $('<div class="sassio-fixed-footer-placeholder" ></div>'); 2328 2329 placeholder.insertBefore(fixed_footer); 2330 placeholder.height(fixed_footer.outerHeight()); 2331 $('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top'))); // for safari 2332 $(window).resize(function(){ 2333 placeholder.height(fixed_footer.outerHeight()); 2334 $('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top'))); 2335 }); 2336 }); 2337 2338 // side navigation bar 2339 new sassio_header_side_nav( $('#sassio-header-side-nav') ); 2340 2341 // sticky navigation 2342 new sassio_sticky_navigation(); 2343 2344 // anchoring 2345 new sassio_anchor(); 2346 2347 // update woocommerce data 2348 $('body').not('.woocommerce-cart, .woocommerce-checkout').trigger('added_to_cart'); 2349 }); 2350 2351})(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.