1/* 2 Name: Pixelwars Blog Framework 3 Description: Shape-Shifter WordPress Theme Framework 4 Version: 2.0 5 Author: pixelwars 6*/ 7 8(function ($) { 9 "use strict"; 10 11 /* global variables */ 12 var $masonry_container; 13 var isSafari = (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1 && navigator.userAgent.indexOf('Android') === -1); 14 var isIE = document.documentMode; 15 var isEdge = /Edge/.test(navigator.userAgent); 16 17 18 // DOCUMENT READY 19 $(function () { 20 21 // DETECT JUNK BROWSERS #$½#£# 22 if (isIE || isEdge) { 23 $('html').addClass('is-MS'); 24 } 25 if (isIE) { 26 $('html').addClass('is-IE'); 27 } 28 if (isEdge) { 29 $('html').addClass('is-Edge'); 30 } 31 32 // BUTTONS : add classes to default buttons 33 $("form input[type=submit], form input[type=button], form button:not(.tutor-btn):not(.tutor-button)").addClass(("is-ready button is-primary " + $('html').data('generic-button-style'))); 34 35 36 // FIX SIDEBAR INSTAGRAM 37 $('.sidebar .instagram-pics, .featured-area .instagram-pics').wrap('<div class="instagram-pics-wrap"></div>'); 38 $('.sidebar .null-instagram-feed > p').appendTo($('.sidebar .instagram-pics-wrap')); 39 $('.featured-area .instagram-pics-wrap + p').appendTo($('.featured-area .instagram-pics-wrap')); 40 41 // FORMS
42 $('input:not([type=submit]):not([type=button]):not([type=file]):not([type=radio]):not([type=checkbox])').addClass('input-text'); 43 44 45 46 // ------------------------------ 47 // STICKY MENU 48 49 50 if (!$('html').hasClass('is-menu-sticky')) { 51 $('.site-header').addClass('original'); 52 } 53 54 55 // HEADER SMALL AND LOGO CENTER 56 if ($('html').hasClass('is-header-logo-center')) { 57 var total = parseInt($('.site-header .nav-menu > ul > li').length / 2); 58 $("<li></li>").addClass('menu-logo').insertAfter('.site-header .nav-menu > ul > li:nth-child(' + total + ')'); 59 $('.site-header .site-branding').clone().appendTo($('.site-header .menu-logo')); 60 $('.site-header').addClass('ready'); 61 } 62 63 64 // STICKY 65 if ($('html').hasClass('is-menu-sticky')) { 66 67 // the element to be sticky 68 var theElement = $('html').hasClass('is-menu-bar') ? $('.site-navigation') : $('.site-header'); 69 var theElement = $('html').hasClass('is-logo-stick-with-menu') ? $('.site-header') : theElement; 70 71 // variables 72 var smart, 73 $orgElement, 74 $clonedElement, 75 orgElementTop, 76 currentScroll, 77 previousScroll = 0, 78 scrollDifference, 79 detachPoint = 650, // point of detach (after scroll passed it, menu is fixed) 80 hideShowOffset = 6, // scrolling value after which triggers hide/show menu 81 $html = $('html'); 82 83 84 // Create a clone of the menu, right next to original. 85 theElement.addClass('original').clone().insertAfter(theElement).addClass('clone').removeClass('original'); 86 87 $orgElement = $('.original'); 88 $clonedElement = $('.clone'); 89 90 /* if ($('html').hasClass('is-logo-stick-with-menu') && $('html').hasClass('is-menu-bar')) { 91 $clonedElement.find('.site-navigation').addClass('clone'); 92 } */ 93 94 95 smart = $('html').hasClass('is-menu-smart-sticky'); 96 97 // fix css max-width issue for the fixed positioned clone element 98 //$clonedElement.width($orgElement.width()); 99 /* $(window).on("resize", function () { 100 $clonedElement.width($orgElement.width()); 101 }); */ 102 if (smart) { 103 $html.addClass('menu-invisible'); 104 } 105 $(window).on("scroll", function () { 106 107 // don't run if mobile menu is toggled on 108 if($html.hasClass('is-menu-toggled-on')) return; 109 110 currentScroll = $(this).scrollTop(), // gets current scroll position 111 scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling 112 113 // fix css max-width issue for the fixed positioned clone element 114 //$clonedElement.width($orgElement.width()); 115 116 //if (window.matchMedia("(min-width: 992px)").matches) { 117 118 orgElementTop = $orgElement.offset().top; 119 120 // Scrolled past the original position; now only show the cloned, sticky element. 121 if (currentScroll >= (orgElementTop) && currentScroll != 0) { 122 123 124 // if : SMART STICKY 125 if (smart) { 126 127 // if scrolled past detach point add class to fix menu 128 if (currentScroll > detachPoint) { 129 if (!$html.hasClass('menu-detached')) { 130 $html.addClass('menu-detached'); 131 } 132 133 // if scrolling faster than hideShowOffset hide/show menu 134 if (scrollDifference >= hideShowOffset) { 135 // scrolling down; hide menu 136 if (currentScroll > previousScroll) { 137 if (!$html.hasClass('menu-invisible')) { 138 $html.addClass('menu-invisible'); 139 } 140 } 141 // scrolling up; show menu 142 else { 143 if ($html.hasClass('menu-invisible')) { 144 $html.removeClass('menu-invisible'); 145 } 146 } 147 } 148 149 } else { 150 if (!$html.hasClass('menu-invisible') && $('html').hasClass('is-header-float')) { 151 $html.addClass('menu-invisible'); 152 } 153 } 154 } // if : smart 155 156 157 // else : NORMAL STICKY 158 else { 159 $clonedElement.addClass('is-visible'); 160 $orgElement.addClass('is-hidden'); 161 $html.addClass('is-sticky-menu-visible'); 162 } 163 164 } 165 // Scrolled past the original position; now only show the cloned, sticky element. 166 167 168 // NOT scrolled past the menu; only show the original menu. 169 else { 170 171 if (smart) { 172 173 $html.addClass('menu-invisible').removeClass('menu-detached'); 174 if ($('html').hasClass('is-header-float')) { 175 176 } else { 177 178 } 179 180 } else { // NORMAL STICKY 181 $clonedElement.removeClass('is-visible'); 182 $orgElement.removeClass('is-hidden'); 183 $html.removeClass('is-sticky-menu-visible'); 184 } 185 } 186 // NOT scrolled past the menu; only show the original menu. 187 188 189 // replace previous scroll position with new one 190 previousScroll = currentScroll; 191 192 193 194 //} // > 991 195 196 }); // window on scroll 197 198 } // STICKY MENU 199 // ------------------------------ 200 201 // ------------------------------ 202 // STICKY: Header Smaller after scrolled down 203 window.addEventListener('scroll', function () { 204 var distanceY = window.pageYOffset || document.documentElement.scrollTop, 205 shrinkOn = 300, 206 $html = $('html'); 207 if (distanceY > shrinkOn) { 208 $html.addClass("is-header-smaller"); 209 } else { 210 if ($html.hasClass("is-header-smaller")) { 211 $html.removeClass("is-header-smaller"); 212 } 213 } 214 }); 215 // ------------------------------ 216 217 218 // ------------------------------ 219 // MOBILE MENU 220 var $menu = $('.nav-menu'); 221 222 // wrap link text with spans (extra span markup is needed for menu link hover styles) 223 $menu.find('li:not(.menu-logo) a').wrapInner("<span class='link-text'></span>"); 224 225 // add classes 226 $menu.find('li').each(function () { 227 if ($(this).children('ul').length) { 228 $(this).addClass('has-submenu'); 229 $(this).find('> a, > a .link-text').append('<span class="submenu-toggle"></span>'); 230 } 231 }); 232 233 var $submenuTrigger = $('.has-submenu .submenu-toggle'); 234 // submenu link click event 235 $submenuTrigger.on("click", function () { 236 $(this).parent().parent().toggleClass('active'); 237 $(this).parent().siblings('ul').toggleClass('active'); 238 return false; 239 }); 240 // ------------------------------ 241 242 243 244 245 // ------------------------------ 246 // SEARCH TOGGLE 247 $('.search-toggle').on("click", function (e) { 248 e.stopPropagation(); 249 var search_input = $(this).parent().find('.search-container input[type="search"]'); 250 $('html').toggleClass('is-search-toggled-on'); 251 if ($('html').hasClass('is-search-toggled-on')) { 252 setTimeout(function () { search_input.trigger('focus'); }, 400); 253 } 254 }); 255 // ------------------------------ 256 257 258 259 // ------------------------------ 260 // HEADER MENU TOGGLE 261 $('.menu-toggle').on("click", function (e) { 262 e.stopPropagation(); 263 $('html').toggleClass('is-menu-toggled-on'); 264 $(this).parents('.site-navigation').toggleClass('is-active'); 265 $(this).parents('.site-header').toggleClass('is-active'); 266 }); 267 268 // one page nav support with hash: close the mobile menu when clicked on an hash link 269 $('.nav-menu a[href*="#"]').on( "click", function() { 270 if (window.matchMedia("(max-width: 992px)").matches) { //needs to work only on mobile menu 271 $(this).parents('.site-navigation').find('.menu-toggle').trigger("click" ); 272 } 273 }); 274 // ------------------------------ 275 276 277 278 /* Slider more-link clone */ 279 $('.post-thumbnail .entry-header .more-link').each(function () { 280 $(this).clone().appendTo($(this).parents('.post-wrap')).addClass('outside'); 281 }); 282 283 284 var sliderAnimations = { 285 286 'backSlide': { 287 'in': 'backSlideInRight', 288 'out': 'backSlideOutLeft', 289 'backIn': 'backSlideInLeft', 290 'backOut': 'backSlideOutRight' 291 }, 292 'scale': { 293 'in': 'scaleIn', 294 'out': 'scaleOut' 295 }, 296 'stackScale': { 297 'in': 'scaleIn', 298 'out': 'zoomOut', 299 'backIn': 'zoomIn', 300 'backOut': 'scaleOut' 301 }, 302 'stackZoom': { 303 'in': 'zoomIn', 304 'out': 'scaleOut', 305 'backIn': 'scaleIn', 306 'backOut': 'zoomOut' 307 }, 308 'fade': { 309 'in': 'fadeIn', 310 'out': 'fadeOut' 311 }, 312 'fadeHorizontal': { 313 'in': 'fadeInRight', 314 'out': 'fadeOutLeft', 315 'backIn': 'fadeInLeft', 316 'backOut': 'fadeOutRight' 317 }, 318 'fadeHorizontalBig': { 319 'in': 'fadeInRightBig',
320 'out': 'fadeOutLeftBig', 321 'backIn': 'fadeInLeftBig', 322 'backOut': 'fadeOutRightBig' 323 }, 324 'fadeVertical': { 325 'in': 'fadeInUp', 326 'out': 'fadeOutUp', 327 'backIn': 'fadeInDown', 328 'backOut': 'fadeOutDown' 329 }, 330 'fadeVerticalBig': { 331 'in': 'fadeInUpBig', 332 'out': 'fadeOutUpBig', 333 'backIn': 'fadeInDownBig', 334 'backOut': 'fadeOutDownBig' 335 }, 336 'jello': { 337 'in': 'jello', 338 'out': 'zoomOut' 339 }, 340 'jelloVertical': { 341 'in': 'jello', 342 'out': 'fadeOutDown', 343 'backIn': 'jello', 344 'backOut': 'fadeOutUp' 345 }, 346 'jelloVerticalBig': { 347 'in': 'jello', 348 'out': 'fadeOutDownBig', 349 'backIn': 'jello', 350 'backOut': 'fadeOutUpBig' 351 }, 352 'jelloHorizontal': { 353 'in': 'jello', 354 'out': 'fadeOutLeft', 355 'backIn': 'jello', 356 'backOut': 'fadeOutRight' 357 }, 358 'jelloHorizontalBig': { 359 'in': 'jello', 360 'out': 'fadeOutLeftBig', 361 'backIn': 'jello', 362 'backOut': 'fadeOutRightBig' 363 }, 364 'swing': { 365 'in': 'swing', 366 'out': 'zoomOut' 367 }, 368 'swingVertical': { 369 'in': 'swing', 370 'out': 'fadeOutDown', 371 'backIn': 'swing', 372 'backOut': 'fadeOutUp' 373 }, 374 'swingVerticalBig': { 375 'in': 'swing', 376 'out': 'fadeOutDownBig', 377 'backIn': 'swing', 378 'backOut': 'fadeOutUpBig' 379 }, 380 'swingHorizontal': { 381 'in': 'swing', 382 'out': 'fadeOutLeft', 383 'backIn': 'swing', 384 'backOut': 'fadeOutRight' 385 }, 386 'swingHorizontalBig': { 387 'in': 'swing', 388 'out': 'fadeOutLeftBig', 389 'backIn': 'swing', 390 'backOut': 'fadeOutRightBig' 391 }, 392 'rubberBand': { 393 'in': 'rubberBand', 394 'out': 'zoomOut' 395 }, 396 'rubberBandVertical': { 397 'in': 'rubberBand', 398 'out': 'fadeOutUp', 399 'backIn': 'rubberBand', 400 'backOut': 'fadeOutDown' 401 }, 402 'rubberBandVerticalBig': { 403 'in': 'rubberBand', 404 'out': 'fadeOutDownBig', 405 'backIn': 'rubberBand', 406 'backOut': 'fadeOutUpBig' 407 }, 408 'rubberBandHorizontal': { 409 'in': 'rubberBand', 410 'out': 'fadeOutLeft', 411 'backIn': 'rubberBand', 412 'backOut': 'fadeOutRight' 413 }, 414 'rubberBandHorizontalBig': { 415 'in': 'rubberBand', 416 'out': 'fadeOutLeftBig', 417 'backIn': 'rubberBand', 418 'backOut': 'fadeOutRightBig' 419 }, 420 'zoom': { 421 'in': 'zoomIn', 422 'out': 'zoomOut' 423 }, 424 'zoomHorizontal': { 425 'in': 'zoomIn', 426 'out': 'fadeOutLeft', 427 'backIn': 'fadeInLeft', 428 'backOut': 'zoomOut' 429 }, 430 'zoomHorizontalBig': { 431 'in': 'zoomIn', 432 'out': 'fadeOutLeftBig', 433 'backIn': 'fadeInLeftBig', 434 'backOut': 'zoomOut' 435 }, 436 'zoomVertical': { 437 'in': 'zoomIn', 438 'out': 'fadeOutUp', 439 'backIn': 'fadeInDown', 440 'backOut': 'zoomOut' 441 }, 442 'zoomVerticalBig': { 443 'in': 'zoomIn', 444 'out': 'fadeOutUpBig', 445 'backIn': 'fadeInDownBig', 446 'backOut': 'zoomOut' 447 }, 448 'zoomInDown': { 449 'in': 'zoomInDown', 450 'out': 'zoomOut' 451 }, 452 'fadeUpZoomOut': { 453 'in': 'fadeInUp', 454 'out': 'zoomOut', 455 'backIn': 'zoomIn', 456 'backOut': 'fadeOutDown' 457 }, 458 'fadeLeftZoomOut': { 459 'in': 'fadeInLeft', 460 'out': 'zoomOut', 461 'backIn': 'zoomIn', 462 'backOut': 'fadeOutLeft' 463 }, 464 'flipVertical': { 465 'in': 'flipInX', 466 'out': 'zoomOut' 467 }, 468 'flipHorizontal': { 469 'in': 'flipInY', 470 'out': 'zoomOut' 471 }, 472 'lightSpeed': { 473 'in': 'lightSpeedInLeft', 474 'out': 'lightSpeedOutLeft', 475 'backIn': 'lightSpeedInRight', 476 'backOut': 'lightSpeedOutRight' 477 }, 478 'jackInTheBox': { 479 'in': 'jackInTheBox', 480 'out': 'zoomOut' 481 }, 482 'hinge': { 483 'out': 'hinge' 484 }, 485 'rotate': { 486 'in': 'rotateIn', 487 'out': 'zoomOut', 488 'backIn': 'zoomIn', 489 'backOut': 'rotateOut' 490 }, 491 'rotateUpSwitch': { 492 'in': 'rotateInUpRight', 493 'out': 'rotateOutDownRight' 494 }, 495 'rotateDownSwitch': { 496 'in': 'rotateInDownRight', 497 'out': 'rotateOutUpRight' 498 }, 499 'rotateHorizontal': { 500 'in': 'rotateInDownLeft', 501 'out': 'rotateOutUpRight', 502 'backIn': 'rotateInDownRight', 503 'backOut': 'rotateOutUpLeft' 504 }, 505 'rotateVertical': {
506 'in': 'rotateInUpRight', 507 'out': 'rotateOutUpRight', 508 'backIn': 'rotateInDownRight', 509 'backOut': 'rotateOutDownRight' 510 }, 511 'jumpIn': { 512 'in': 'jumpIn', 513 'out': 'zoomOut' 514 }, 515 'blur': { 516 'in': 'blurIn', 517 'out': 'blurOut' 518 }, 519 'blurZoom': { 520 'in': 'blurZoomIn', 521 'out': 'blurZoomOut' 522 }, 523 'blurScale': { 524 'in': 'blurScaleIn', 525 'out': 'blurScaleOut' 526 }, 527 'blurStackScale': { 528 'in': 'blurScaleIn', 529 'out': 'blurZoomOut', 530 'backIn': 'blurZoomIn', 531 'backOut': 'blurScaleOut' 532 }, 533 'blurStackZoom': { 534 'in': 'blurZoomIn', 535 'out': 'blurScaleOut', 536 'backIn': 'blurScaleIn', 537 'backOut': 'blurZoomOut' 538 }, 539 'invert': { 540 'in': 'invert' 541 } 542 }; 543 544 // console.log('Total Slider Animations Count is ' + Object.keys(sliderAnimations).length); 545 546 547 // ------------------------------ 548 // OWL-CAROUSEL 549 var owl = $('.owl-carousel'); 550 $('.slider-box .post-thumbnail .entry-header').removeClass('ready'); 551 if (owl.length) { 552 owl.each(function (index, element) { 553 554 var items = $(element).data('items'); 555 var animate = $(element).data('animation'); 556 //var animate = 'jello';
557 var animateIn, animateOut, backAnimateIn, backAnimateOut; 558 var mouseDrag = $(element).data('mouse-drag'); 559 560 // check if the animations is defined 561 if (sliderAnimations[animate] !== undefined && items <= 1) { 562 563 // mouse drag is always of when custom animation is on 564 mouseDrag = false; 565 $(element).addClass('custom-animation'); 566 567 animateIn = isIE ? 'fadeIn' : sliderAnimations[animate].in; 568 animateOut = isIE ? 'fadeOut' : sliderAnimations[animate].out; 569 backAnimateIn = isIE ? 'fadeIn' : sliderAnimations[animate].backIn; 570 backAnimateOut = isIE ? 'fadeOut' : sliderAnimations[animate].backOut; 571 } 572 573 //wait for images 574 $(element).imagesLoaded(function () { 575 576 //remove loading 577 $(element).find('.loading').remove(); 578 579 $(element).owlCarousel({ 580 mouseDrag: mouseDrag, 581 dots: $(element).data('dots'), 582 nav: $(element).data('nav'), 583 autoplay: $(element).data('autoplay'), 584 autoplayTimeout: $(element).data('autoplay-timeout'), 585 autoplayHoverPause: true, 586 navText: false, 587 rewind: $(element).data('rewind'), 588 center: $(element).data('center'), 589 loop: $(element).data('loop'), 590 // margin : 60, 591 // stagePadding: 200, 592 navSpeed: 350, 593 dotsSpeed: 250, 594 responsiveRefreshRate: 10, 595 smartSpeed: 1000, // slide change animation duration when autoplay is on *this causes to unintended autoplay start on mobile after interacted with slider 596 autoHeight: true, 597 animateIn: animateIn, 598 animateOut: animateOut, 599 backAnimateIn: backAnimateIn, 600 backAnimateOut: backAnimateOut, 601 responsive: { 602 0: { 603 items: 1, 604 nav: true 605 }, 606 700: { 607 items: items <= 2 ? items : 2, 608 nav: false 609 }, 610 960: { 611 items: items <= 3 ? items : 3, 612 nav: true 613 }, 614 1260: { 615 items: items <= 4 ? items : 4, 616 nav: true 617 } 618 }, 619 onTranslated: function () { 620 621 // fix: slider always autoplays on mobile after interaction with the slider 622 if ($(element).data('autoplay') !== true) { 623 $(element).trigger('stop.owl.autoplay'); 624 } 625 }, 626 onInitialized: function () { 627 628 629 // ------------------------------ 630 // PARALLAX 631 if (!isIE) { 632 633 var $container = $('.post-slider'); 634 $('.post-slider .post-thumbnail').each(function () { 635 if ($(this).data('parallax-video')) { //parallax video 636 $(this).jarallax({ 637 speed: 0, 638 zIndex: 1, 639 elementInViewport: $container, 640 videoSrc: $(this).data('parallax-video') 641 }); 642 } else if ($('html').hasClass('is-slider-parallax')) { //parallax image 643 $(this).jarallax({ 644 elementInViewport: $container, 645 zIndex: 1, 646 speed: 0.7, 647 disableParallax: function () { 648 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 649 } 650 }); 651 } // else if 652 }); // each 653 654 } // isIE 655 // ------------------------------ 656 657 658 // responsive text 659 fitSliderTitle(); 660 setTimeout(function () { 661 $('.post-thumbnail .entry-header').addClass('ready'); 662 }, 300); 663 664 var fixWaitTime; 665 $(window).on('resize', function () { 666 clearTimeout(fixWaitTime); 667 fixWaitTime = setTimeout(function () { 668 fitSliderTitle(); 669 }, 500); 670 }); 671 672 // update sticky sidebar 673 sticky_sidebar_update(); 674 675 676 } // onInitialized 677 678 }); // owlCarousel() 679 680 681 // listen for slider element self resize and refresh carousel : this fix many issues 682 new ResizeSensor($('.owl-carousel'), function () { 683 $(element).trigger('refresh.owl.carousel'); 684 }); 685 686 687 // fix for: nav = false not working 688 if ($(element).data('nav') !== true) { 689 $(element).find('.owl-nav').hide(); 690 } 691 692 693 }); // wait for images 694 695 696 697 698 }); // owl.each() 699 700 function fitSliderTitle() { 701 $('.slider-box .entry-title').fitText($('html').data('title-ratio'), { minFontSize: '12px', maxFontSize: '220px' }); 702 } 703 } 704 // ------------------------------ 705 706 707 708 709 // ------------------------------ 710 // PARALLAX 711 var video_parallax = $(".header-wrap, .intro, .post-thumbnail"); 712 713 video_parallax.each(function () { 714 if ($(this).data('parallax-video')) { 715 $(this).jarallax({ 716 speed: 0, 717 zIndex: 1, 718 videoSrc: $(this).data('parallax-video') 719 }); 720 } 721 }); 722 723 // PARALLAX HEADER BG IMAGE 724 $('.is-header-parallax .header-wrap').jarallax({ 725 zIndex: 1, 726 speed: 0.6, 727 disableParallax: function () { 728 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 729 } 730 }); 731 732 // PARALLAX INTRO BG IMAGE 733 $('.is-intro-parallax .intro').jarallax({ 734 zIndex: 1, 735 speed: 0.6, //from -1.0 to 2.0, 736 disableParallax: function () { 737 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 738 } 739 }); 740 741 // PARALLAX LINK BOXES 742 if (!(isIE || isEdge)) { // buggy on IE : disable for now 743 $('.is-link-box-parallax .link-box .post-thumbnail').jarallax({ 744 zIndex: 1, 745 speed: isSafari ? 0.5 : 0.7, // safari weird performance fix, 746 disableParallax: function () { 747 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 748 } 749 }); 750 } 751 // PARALLAX RELATED POSTS 752 if (!(isIE || isEdge)) { // buggy on IE : disable for now 753 $('.is-related-posts-parallax .related-posts .post-thumbnail').jarallax({ 754 zIndex: 1, 755 speed: 0.8, 756 disableParallax: function () { 757 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 758 } 759 }); 760 } 761 762 // PARALLAX IMAGE IN POST 763 parallaxImages(); 764 // ------------------------------ 765 766 767 768 769 // ------------------------------ 770 // POST THUMBNAILS 771 var post_thumbnail = $('.post-thumbnail'); 772 if (post_thumbnail.length) { 773 774 singlePostParallax();
775 776 777 778 // optimized background images for various screens 779 post_thumbnail.each(function () { 780 781 var postThumbnail = $(this); 782 var parallax = postThumbnail.find('[id^="jarallax"] div'); 783 var isParallax = parallax.length; 784 var parallaxRatio = (isParallax && postThumbnail.parent('.post-header-overlay-inline').length) ? 1.5 : 1; 785 var src = ""; 786 787 if (postThumbnail.width() * window.devicePixelRatio * parallaxRatio > 1060) { // big screens 788 src = postThumbnail.data('large-image'); 789 } else if (postThumbnail.width() * window.devicePixelRatio * parallaxRatio > 550) { // retina phones or tablets 790 src = postThumbnail.data('medium-image'); 791 } 792 793 if (src !== "") { 794 795 $("<img />").attr("src", src).load(function () { 796 if (isParallax) { 797 parallax.css('background-image', 'url(' + src + ')'); 798 } else { 799 postThumbnail.css('background-image', 'url(' + src + ')'); 800 } 801 }); 802 } 803 804 }); 805 806 $('*:not(.slider-post) > .post-thumbnail .entry-header').addClass('ready'); 807 808 } 809 // ------------------------------ 810 811 812 813 814 // ------------------------------ 815 // Fitvids.js : fluid width video embeds 816 $("body").fitVids({ customSelector: 'iframe[src*="facebook.com/plugins/video"], iframe[src*="facebook.com/video/embed"]' }); 817 // preserve 16:9 aspect ratio for soundcloud embeds 818 // $('.hentry iframe[src*="soundcloud.com"]').wrap('<div class="fluid-audio fluid-width-video-wrapper"></div>'); 819 $('.fluid-width-video-wrapper').wrap('<div class="media-wrap"></div>'); 820 // ------------------------------ 821 822 823 // ------------------------------ 824 // FluidBox : Zoomable Images 825 setupFluidbox(); 826 // ------------------------------ 827 828 829 830 // ------------------------------ 831 // FORM VALIDATION 832 // comment form validation fix 833 $('#commentform, .post-password-form, .mc4wp-form form, .mc4wp-form').addClass('validate-form'); 834 $('#commentform').find('input,textarea').each(function (index, element) { 835 if ($(this).attr('aria-required') == "true") { 836 $(this).addClass('required'); 837 } 838 if ($(this).attr('name') == "email") { 839 $(this).addClass('email'); 840 } 841 }); 842 843 // validate form 844 if ($('.validate-form').length) { 845 $('.validate-form').each(function () { 846 $(this).validate(); 847 }); 848 } 849 // ------------------------------ 850 851 852 853 854 // ------------------------------ 855 // GALLERY COLLAGE LAYOUT 856 collage(); 857 858 var resizeTimer = null; 859 $(window).bind('resize', function () { 860 861 // hide all the images until we resize them 862 // set the element you are scaling i.e. the first child nodes of ```.Collage``` to opacity 0 863 $('.gallery figure').css("opacity", 0); 864 // set a timer to re-apply the plugin 865 if (resizeTimer) clearTimeout(resizeTimer); 866 resizeTimer = setTimeout(collage, 1200); 867 collage(); 868 }); 869 // ------------------------------ 870 871 872 // ------------------------------ 873 // LIGHTBOX - applied to gallery post format a[href*=".jpg"] 874 875 // zoomable text links 876 $('.entry-content .lightbox').wrap("<span class='lightbox'></span>"); 877 878 if ($('.lightbox, .gallery, .wp-block-gallery, .portfolio-grid .hentry-middle, .portfolio-grid .featured-image').length && !$('body').hasClass('elementor-page')) { 879 $('.lightbox, .gallery, .wp-block-gallery, .portfolio-grid .hentry-middle, .portfolio-grid .featured-image').each(function (index, element) { 880 var $media_box = $(this); 881 $media_box.magnificPopup({ 882 delegate: '.lightbox, .gallery-item a[href$=".jpg"], .gallery-item a[href$=".jpeg"], .gallery-item a[href$=".png"], .gallery-item a[href$=".gif"], .wp-block-image a[href$=".jpg"], .wp-block-image a[href$=".jpeg"], .wp-block-image a[href$=".png"], .wp-block-image a[href$=".gif"]', 883 type: 'image', 884 image: { 885 markup: '<div class="mfp-figure">' + 886 '<div class="mfp-close"></div>' + 887 '<div class="mfp-img"></div>' + 888 '</div>' + 889 '<div class="mfp-bottom-bar">' + 890 '<div class="mfp-title"></div>' + 891 '<div class="mfp-counter"></div>' + 892 '</div>', // Popup HTML markup. `.mfp-img` div will be replaced with img tag, `.mfp-close` by close button 893 894 cursor: 'mfp-zoom-out-cur', // Class that adds zoom cursor, will be added to body. Set to null to disable zoom out cursor. 895 verticalFit: true, // Fits image in area vertically 896 tError: '<a href="%url%">The image</a> could not be loaded.' // Error message 897 }, 898 gallery: { 899 enabled: true, 900 tCounter: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter 901 }, 902 iframe: { 903 markup: '<div class="mfp-iframe-scaler">' + 904 '<div class="mfp-close"></div>' + 905 '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' + 906 '<div class="mfp-title">Some caption</div>' + 907 '</div>' 908 }, 909 mainClass: 'mfp-zoom-in', 910 tLoading: '', 911 removalDelay: 300, //delay removal by X to allow out-animation 912 callbacks: { 913 markupParse: function (template, values, item) { 914 var title = ""; 915 if (item.el.parents('.gallery-item').length) { 916 title = item.el.parents('.gallery-item').find('.gallery-caption').text(); 917 } else if (item.el.parents('.wp-block-image').length) { 918 title = item.el.parents('.wp-block-image').find('.wp-element-caption').text(); 919 } else { 920 title = item.el.attr('title') == undefined ? "" : item.el.attr('title'); 921 } 922 //return title; 923 values.title = title; 924 }, 925 imageLoadComplete: function () { 926 var self = this; 927 setTimeout(function () { 928 self.wrap.addClass('mfp-image-loaded'); 929 }, 16); 930 }, 931 close: function () { 932 this.wrap.removeClass('mfp-image-loaded'); 933 }, 934 935 beforeAppend: function () { 936 937 var self = this; 938 939 // square aspect ratio for soundcloud embeds 940 if (this.content.find('iframe[src*="soundcloud.com"]').length) { 941 self.wrap.addClass('is-soundcloud'); 942 } else { 943 self.wrap.removeClass('is-soundcloud'); 944 } 945 946 this.content.find('iframe').on('load', function () { 947 setTimeout(function () { 948 self.wrap.addClass('mfp-image-loaded'); 949 }, 16); 950 });
951 952 } 953 }, 954 closeBtnInside: false, 955 closeOnContentClick: true, 956 midClick: true 957 }); 958 }); 959 } 960 // ------------------------------ 961 962 963 // gutenberg gallery masonry 964 var $wp_gallery = $('.wp-block-gallery:not(.is-cropped)'); 965 $wp_gallery.each(function() { 966 967 $wp_gallery.isotope({ 968 // options 969 itemSelector: '.wp-block-image', 970 layoutMode: 'masonry' 971 }); 972 // layout Isotope after each image loads 973 $wp_gallery.imagesLoaded().progress( function() { 974 $wp_gallery.isotope('layout'); 975 }); 976 977 }); 978 979 980 981 982 // ------------------------------ 983 // MASONRY - ISOTOPE 984 $masonry_container = $('.masonry'); 985 if ($masonry_container.length) { 986 987 $masonry_container.imagesLoaded(function () { 988 // initialize isotope 989 $masonry_container.isotope({ 990 itemSelector: '.hentry', 991 layoutMode: $masonry_container.data('layout'), 992 transitionDuration: $masonry_container.hasClass('portfolio-grid') ? 400 : 0 993 }); 994 995 setMasonry(); 996 setTimeout(function () { $masonry_container.isotope(); }, 20); 997 // filters 998 if ($masonry_container.data('isotope')) { 999 var filters = $('.filters'); 1000 if (filters.length) { 1001 filters.find('a').on("click", function () { 1002 var selector = $(this).attr('data-filter'); 1003 $masonry_container.isotope({ filter: selector }); 1004 $(this).parent().addClass('current').siblings().removeClass('current'); 1005 return false; 1006 }); 1007 } 1008 } 1009 1010 // fix item widths on resize 1011 $(window).on('resize', function () { 1012 setMasonry(); 1013 }); 1014 1015 1016 1017 }); // images loaded 1018 } 1019 // ------------------------------ 1020 1021 1022 1023 1024 // ------------------------------ 1025 // FULL WIDTH IMAGES with caption fix 1026 if ($('figure img.full').length) { 1027 $('figure img.full').parent().addClass('full'); 1028 } 1029 // ------------------------------ 1030 1031 1032 // ------------------------------ 1033 // HOME LANDING FULLSCREEN VIDEO 1034 var fs_video = $('.intro-vid'); 1035 if (fs_video.length) { 1036 //fs_video.wrap( "<div class='fs-video'></div>" ); 1037 //fs_video = $('.fs-video'); 1038 bgVideo(fs_video); 1039 $(window).resize(function () { 1040 bgVideo(fs_video); 1041 //setTimeout(bgVideo(fs_video), 1500); 1042 }); 1043 } 1044 1045 var resizeTimerVideo = null; 1046 $(window).bind('resize', function () { 1047 if (resizeTimerVideo) { 1048 clearTimeout(resizeTimerVideo); 1049 } 1050 resizeTimerVideo = setTimeout(bgVideo(fs_video), 200); 1051 }); 1052 // ------------------------------ 1053 1054 1055 1056 // ------------------------------ 1057 // STICKY SIDEBAR 1058 sticky_sidebar(); 1059 1060 // fix for : sticky sidebar overlap when resized to mobile view 1061 $(window).resize(function () { 1062 sticky_sidebar_update(); 1063 }); 1064 // ------------------------------ 1065 1066 1067 // ------------------------------ 1068 // LINK BOX FIT TEXT 1069 $('.link-box .entry-title').fitText($('html').data('link-box-title-ratio'), { minFontSize: '12px' }); 1070 // ------------------------------ 1071 1072 1073 1074 // ------------------------------ 1075 // FIX HEADER 1076 fixHeader(); 1077 $(window).resize(function () { 1078 fixHeader(); 1079 setTimeout(function () { fixHeader(); }, 500); // wait for slider post resize 1080 }); 1081 // ------------------------------ 1082 1083 1084 1085 // ------------------------------ 1086 // FULL SCREEN POST RATIO FIX 1087 fixFsRatio(); 1088 $(window).resize(function () { 1089 fixFsRatio(); 1090 setTimeout(function () { fixFsRatio(); }, 500); // wait for slider post resize 1091 }); 1092 // ------------------------------ 1093 1094 1095 1096 // ------------------------------ 1097 // https://getwaves.io/ 1098 // https://tympanus.net/Development/SectionSeparators/ 1099 // https://smooth.ie/blogs/news/svg-wavey-transitions-between-sections 1100 var headerShape = $('html').data('header-bg-shape'); 1101 if (headerShape !== undefined) { 1102 1103 var headerSvg; 1104 switch (headerShape) { 1105 case "curtain": 1106 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 22" preserveAspectRatio="none"><path fill="currentColor" stroke="currentColor" d="M0 0 Q 2.5 40 5 0 Q 7.5 40 10 0 Q 12.5 40 15 0 Q 17.5 40 20 0 Q 22.5 40 25 0 Q 27.5 40 30 0 Q 32.5 40 35 0 Q 37.5 40 40 0 Q 42.5 40 45 0 Q 47.5 40 50 0 Q 52.5 40 55 0 Q 57.5 40 60 0 Q 62.5 40 65 0 Q 67.5 40 70 0 Q 72.5 40 75 0 Q 77.5 40 80 0 Q 82.5 40 85 0 Q 87.5 40 90 0 Q 92.5 40 95 0 Q 97.5 40 100 0 Z"></path></svg>'; 1107 break; 1108 case "chevron": 1109 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 102" preserveAspectRatio="none">
1109<path fill="currentColor" stroke="currentColor" d="M0 0 L50 100 L100 0 Z"></path></svg>'; 1110 break; 1111 case "round": 1112 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0.1 0.3 200 19" preserveAspectRatio="none"><g transform="translate(-0.21755166,-100.15454)"><path style="fill:currentColor;" d="M 0.2688579,100.29477 H 200.98548 c 0,0 -99.37375,39.84098 -200.7166221,0 z"></path></g></svg>' 1113 break; 1114 case "round_layers": 1115 headerSvg = '<svg viewBox="0 0 1280 140" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 0v.48C18.62 9.38 297.81 140 639.5 140 993.24 140 1280 0 1280 0z" fill-opacity=".3"></path><path d="M0 .6c14 8.28 176.54 99.8 555.45 119.14C952.41 140 1280 0 1280 0H0z" fill-opacity=".5"></path><path d="M726.29 101.2C1126.36 79.92 1281 0 1281 0H1c.05 0 325.25 122.48 725.29 101.2z"></path></g></svg>'; 1116 break; 1117 case "cut_left": 1118 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,0L720,128L1440,288L1440,0L720,0L0,0Z"></path></svg>'; 1119 break; 1120 case "cut_left_round": 1121 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,64L120,101.3C240,139,480,213,720,250.7C960,288,1200,288,1320,288L1440,288L1440,0L1320,0C1200,0,960,0,720,0C480,0,240,0,120,0L0,0Z"></path></svg>'; 1122 break; 1123 case "cut_right": 1124 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,320L1440,32L1440,0L0,0Z"></path></svg>'; 1125 break; 1126 case "cut_right_round": 1127 headerSvg = '<svg viewBox="0 0 500 150" preserveAspectRatio="none"><path d="M-12.69,143.58 C107.50,141.61 373.87,152.45 522.29,-1.47 L500.00,0.00 L0.00,0.00 Z" style="stroke: none; fill: currentColor;"></path></svg>'; 1128 break; 1129 case "wave_1": 1130 headerSvg = '<svg width="100%" height="120" viewBox="0.1 0.1 180 40" preserveAspectRatio="none"><g transform="translate(-18.298844,-77.973964)"><path style="fill:currentColor;" d="M 31.615583,86.351641 H 192.16499 v 26.901969 c 0,0 -32.03411,-14.237983 -59.62682,-12.72484 -22.34188,1.2252 -54.779359,9.72634 -54.779359,9.72634 0,0 -22.029534,3.62882 -34.471238,-1.88988 -12.441702,-5.51871 -11.67199,-22.013589 -11.67199,-22.013589 z"></path><path style="fill:currentColor;" d="M 18.441597,78.106256 H 198.58126 v 39.288614 c 0,0 -43.10672,-27.825245 -73.47599,-19.687823 -30.369264,8.137423 -46.832208,12.548653 -46.832208,12.548653 0,0 -32.775418,8.05972 -46.735258,0 C 17.577964,102.19598 18.441597,78.106256 18.441597,78.106256 Z"></path></g></svg>'; 1131 break; 1132 case "wave_2": 1133 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"> <path fill="currentColor" fill-opacity="1" d="M0,160L16,176C32,192,64,224,96,202.7C128,181,160,107,192,101.3C224,96,256,160,288,186.7C320,213,352,203,384,208C416,213,448,235,480,218.7C512,203,544,149,576,122.7C608,96,640,96,672,112C704,128,736,160,768,160C800,160,832,128,864,101.3C896,75,928,53,960,90.7C992,128,1024,224,1056,218.7C1088,213,1120,107,1152,96C1184,85,1216,171,1248,213.3C1280,256,1312,256,1344,240C1376,224,1408,192,1424,176L1440,160L1440,0L1424,0C1408,0,1376,0,1344,0C1312,0,1280,0,1248,0C1216,0,1184,0,1152,0C1120,0,1088,0,1056,0C1024,0,992,0,960,0C928,0,896,0,864,0C832,0,800,0,768,0C736,0,704,0,672,0C640,0,608,0,576,0C544,0,512,0,480,0C448,0,416,0,384,0C352,0,320,0,288,0C256,0,224,0,192,0C160,0,128,0,96,0C64,0,32,0,16,0L0,0Z"></path></svg>'; 1134 break; 1135 case "wave_3": 1136 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,128L60,112C120,96,240,64,360,48C480,32,600,32,720,80C840,128,960,224,1080,266.7C1200,309,1320,299,1380,293.3L1440,288L1440,0L1380,0C1320,0,1200,0,1080,0C960,0,840,0,720,0C600,0,480,0,360,0C240,0,120,0,60,0L0,0Z"></path></svg>'; 1137 break; 1138 case "ribbon": 1139 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none">
1139<path fill="currentColor" fill-opacity="1" d="M0,256L720,128L1440,256L1440,0L720,0L0,0Z"></path></svg>'; 1140 break; 1141 case "ribbon_round": 1142 headerSvg = '<svg viewBox="0 0 500 150" preserveAspectRatio="none"><path d="M-12.13,150.48 C196.66,-30.09 318.00,-15.28 512.13,146.53 L500.84,-29.11 L-7.05,-11.34 Z" style="stroke: none; fill: currentColor;"></path></svg>'; 1143 break; 1144 case "lines_1": 1145 headerSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" preserveAspectRatio="none"><path fill="currentColor" fill-opacity="1" d="M0,128L160,192L320,64L480,256L640,96L800,288L960,0L1120,256L1280,288L1440,0L1440,0L1280,0L1120,0L960,0L800,0L640,0L480,0L320,0L160,0L0,0Z"></path></svg>'; 1146 break; 1147 } 1148 1149 // add svg to header or menu 1150 if ($('html').hasClass('is-menu-bottom')) { 1151 $('.site-header .menu-wrap').append(headerSvg); 1152 $('.site-header .menu-wrap > svg').addClass('header-bg-shape'); 1153 } else { 1154 $('.site-header .header-wrap').append(headerSvg); 1155 $('.site-header .header-wrap > svg').addClass('header-bg-shape'); 1156 } 1157 1158 1159 } 1160 // END: HEADER SVG SHAPES 1161 // ------------------------------ 1162 1163 1164 // ------------------------------ 1165 // STICKY AUDIO EMBEDS 1166 if($('html.is-audio-embeds-sticky body.single-post').length) { 1167 $('iframe[src*="spotify.com"],iframe[src*="podbean.com"],iframe[src*="soundcloud.com"],iframe[src*="simplecast.com"],iframe[src*="tunein.com"],iframe[src*="anchor.fm"],iframe[src*="radiopublic.com"],iframe[src*="castbox.fm"],iframe[src*="iheart.com"],iframe[src*="libsyn.com"],iframe[src*="deezer.com"],iframe[src*="mixcloud.com"],iframe[src*="buzzsprout.com"],iframe[src*="spreaker.com"],iframe[src*="cadence13.com"],iframe[src*="ausha.co"],iframe[src*="podomatic.com"],iframe[src*="blogtalkradio.com"],iframe[src*="megaphone.fm"],iframe[src*="transistor.fm"], iframe[src*="captivate.fm"]').addClass('sticky-audio'); 1168 1169 var sticky_audio_height = $('.sticky-audio').height(); 1170 $('html').css('padding-bottom', sticky_audio_height); 1171 if($('html').hasClass('is-sidebar-sticky')) { 1172 $('.sidebar-wrap').css('padding-bottom', sticky_audio_height ); 1173 } 1174 } 1175 // END: STICKY AUDIO EMBEDS 1176 // ------------------------------ 1177 1178 1179 1180 }); 1181 // DOCUMENT READY 1182 1183 1184 1185 1186 // WINDOW ONLOAD 1187 window.onload = function () { 1188 1189 /* FIX HEADER */ 1190 fixHeader(); 1191 1192 // FULL SCREEN POST RATIO FIX 1193 fixFsRatio(); 1194 setTimeout(function () { fixHeader(); fixFsRatio(); }, 500); // yet another fix for IE11 $#½$#£# 1195 1196 1197 sticky_sidebar_update(); 1198 1199 // html addclass : loaded 1200 $('html').addClass('loaded'); 1201 1202 // intro video bg 1203 bgVideo($('.intro-vid')); 1204 1205 1206 1207 1208 // ------------------------------ 1209 // NOT FINAL * 1210 // should be compatible with elements which height is longer than viewport 1211 // you may check : https://codepen.io/BoyWithSilverWings/pen/MJgQqR 1212 1213 // ------------------------------ 1214 // Blur Slider Image On Scroll 1215 if ($('html').hasClass('is-slider-image-blur-on-scroll')) { 1216 blurItemOnScroll('.featured-area .post-slider .post-wrap + div'); 1217 } 1218 // ------------------------------ 1219 1220 1221 // ------------------------------ 1222 // Blur Link Box Image On Scroll 1223 if ($('html').hasClass('is-link-box-image-blur-on-scroll')) { 1224 blurItemOnScroll('.featured-area .link-box .post-wrap + div'); 1225 } 1226 // ------------------------------ 1227 1228 // ------------------------------ 1229 // Blur Featured Image On Scroll 1230 if ($('html').hasClass('is-featured-image-blur-on-scroll')) { 1231 blurItemOnScroll('.featured-image img'); 1232 blurItemOnScroll('.top-content-single .post-wrap + div'); 1233 blurItemOnScroll('.top-content-single iframe'); 1234 } 1235 // ------------------------------ 1236 // ------------------------------ 1237 // NOT FINAL * 1238 1239 1240 }; 1241 // WINDOW ONLOAD 1242 1243 1244 1245 1246 // ------------------------------------------------- 1247 // FUNCTIONS 1248 1249 1250 // ------------------------------ 1251 // BLUR ITEM ON SCROLL 1252 function blurItemOnScroll(item) { 1253 if ($(item).length) { 1254 $(window).scroll(function () { 1255 $(item).each(function (index) { 1256 // console.log($(item).offset().top); 1257 var oVal = ($(window).scrollTop() - $(this).offset().top) / 50; 1258 oVal = oVal < 1 ? 0 : oVal; 1259 var filterVal = 'blur(' + oVal + 'px)'; 1260 $(this) 1261 .css('filter', filterVal) 1262 .css('webkitFilter', filterVal) 1263 .css('mozFilter', filterVal) 1264 .css('oFilter', filterVal) 1265 .css('msFilter', filterVal); 1266 }); 1267 1268 1269 }); 1270 } 1271 } 1272 // ------------------------------ 1273 1274 1275 // ------------------------------ 1276 // FIX HEADER 1277 function fixHeader() { 1278 1279 /* HEADER FLOATING - negative margin for the containers that comes after header */ 1280 if ($('html').hasClass('is-header-float') && !($('html').hasClass('is-header-vertical')) ) { 1281 1282 var headerHeight = 1283 parseInt($('.site-header:not(.clone)').outerHeight()) + 1284 parseInt($('.site-header:not(.clone)').css('marginTop') + 1285 parseInt($('.site-header:not(.clone) .header-wrap').css('marginTop'))); 1286 1287 //console.log(-parseInt($('.site-header:not(.clone) .header-wrap').css('marginTop'))); 1288 headerHeight = $('.top-bar').length ? headerHeight + parseInt($('.top-bar').outerHeight()) : headerHeight; 1289 $('.top-content, .site-header + .site-main, .top-content-single, .site-header ~ .elementor').css('marginTop', '-' + ++headerHeight + 'px'); 1290 1291 } 1292 /* END: HEADER FLOATING */ 1293 1294 1295 /* MENU TOP LOGO OVERFLOW - positive margin for the container that c
1295omes after header */ 1296 if (!($('html').hasClass('is-header-float')) && $('html').is('.is-menu-top.is-logo-overflow')) { 1297 1298 var headerHeight = parseInt($('.site-header:not(.clone) .site-branding').outerHeight()) / 2; 1299 $('.site-header:not(.clone) .header-wrap').css('marginBottom', '-' + headerHeight + 'px'); 1300 $('.site-header + .site-main').css('marginTop', + headerHeight + 'px'); 1301 1302 } 1303 /* END: MENU TOP LOGO OVERFLOW */ 1304 1305 1306 /* MENU BOTTOM OVERFLOW - positive margin for the container that comes after header */ 1307 if (!($('html').hasClass('is-header-float')) && $('html').is('.is-menu-bottom.is-menu-bottom-overflow')) { 1308 1309 var headerHeight = parseInt($('.site-header:not(.clone) .site-navigation:not(.clone)').outerHeight()) / 2; 1310 $('.site-header:not(.clone) .site-navigation:not(.clone)').css('marginBottom', '-' + headerHeight + 'px'); 1311 $('.site-header + .site-main').css('marginTop', + headerHeight + 'px'); 1312 1313 } 1314 /* END: MENU BOTTOM OVERFLOW */ 1315 1316 1317 /* HEADER VERTICAL */ 1318 var isHeaderVertical = $('html').hasClass('is-header-vertical'), 1319 isHeaderVerticalLeft = $('html').hasClass('is-header-vertical-left'), 1320 isHeaderVerticalRight = $('html').hasClass('is-header-vertical-right'); 1321 1322 if (isHeaderVertical) { 1323 1324 var header = $('.site-header'); 1325 1326 // SubMenu padding top fix for all browsers and for all level submenus 1327 $('.nav-menu li.has-submenu').each(function () { 1328 $(this).find('ul').css("padding-top", ($(this).offset().top - $(window).scrollTop()) + 'px'); 1329 }); 1330 1331 // header vertical left : fix for 1st level submenu left for all browsers 1332 if (isHeaderVerticalLeft) { 1333 $('.nav-menu > ul > li > ul').css("left", (header.offset().left + header.width()) + 'px'); 1334 } 1335 1336 // header vertical right : fix for 1st level submenu right for all browsers 1337 if (isHeaderVerticalRight) { 1338 var offsetRight = ($(window).width() - (header.offset().left + header.outerWidth())); 1339 var right = header.width() + offsetRight - 1; 1340 $('.nav-menu > ul > li > ul').css("right", right + 'px'); 1341 } 1342 1343 // IE 11 3rd level submenu left fix 1344 if (isIE) { 1345 $('.nav-menu ul ul ul').each(function () { 1346 // find out how many parent ul element there is of this submenu 1347 var depth = $(this, ".nav-menu").parents("ul").length; 1348 var subWidth = $('.nav-menu ul ul').width(); 1349 1350 if (isHeaderVerticalLeft) { 1351 $(this).css("left", (header.offset().left + header.width() + (subWidth * --depth)) + 'px'); 1352 } 1353 else if (isHeaderVerticalRight) { 1354 var offsetRight = ($(window).width() - header.offset().left); 1355 var right = (subWidth * --depth) + offsetRight; 1356 $(this).css("right", right + 'px'); 1357 } 1358 }); 1359 } //end if isIE 1360 1361 1362 } // end if isHeaderVertical 1363 /* END: HEADER VERTICAL */ 1364 1365 1366 } // end fixHeader() 1367 // ------------------------------ 1368 1369 1370 // ------------------------------ 1371 // FIX FS RATIO for slider post 1372 function fixFsRatio() { 1373 if (!($('html').hasClass('is-header-float'))) { 1374 1375 var headerHeight = parseInt($('.site-header:not(.clone').outerHeight()) + parseInt($('.site-header:not(.clone)').css('marginTop')); 1376 1377 /* menu top logo overflow fix */ 1378 headerHeight = $('html').is('.is-menu-top.is-logo-overflow') ? headerHeight - (parseInt($('.site-header:not(.clone) .site-branding').outerHeight()) / 2) : headerHeight; 1379 1380 /* header vertical fix */ 1381 headerHeight = $('html').hasClass('is-header-vertical') ? 0 : headerHeight; 1382 1383 /* add top-bar height too */ 1384 headerHeight = $('.top-bar').length ? headerHeight + parseInt($('.top-bar').outerHeight()) : headerHeight; 1385 1386 // fix for 1px empty space from bottom - sometimes 1387 headerHeight--; 1388 1389 $('.ratio-fs .post-wrap').css('minHeight', 'calc(100vh - ' + headerHeight + 'px)'); 1390 1391 } 1392 } 1393 // ------------------------------ 1394 1395 1396 // ------------------------------ 1397 // SINGLE POST PARALLAX 1398 function singlePostParallax() { 1399 // PARALLAX OVERLAY POST OVERLAY MEDIUM 1400 $('.is-top-content-single-medium .post-thumbnail').jarallax({ 1401 zIndex: 1, 1402 speed: 0.6, 1403 disableParallax: function () { 1404 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 1405 } 1406 }); 1407 1408 // PARALLAX OVERLAY POST OVERLAY FULL/FULL MARGINS 1409 $('.is-top-content-single-full .post-thumbnail, .is-top-content-single-full-screen .post-thumbnail, .is-top-content-single-full-margins .post-thumbnail').jarallax({ 1410 zIndex: 1, 1411 speed: 0.6, 1412 disableParallax: function () { 1413 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 1414 } 1415 }); 1416 1417 // PARALLAX OVERLAY POST OVERLAY INLINE 1418 $('.post-header-overlay-inline .post-thumbnail').jarallax({ 1419 zIndex: 1, 1420 speed: 0.7, 1421 disableParallax: function () { 1422 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 1423 } 1424 }); 1425 1426 } 1427 // ------------------------------ 1428 1429 1430 1431 // ------------------------------ 1432 // STICKY SIDEBAR 1433 var stickySidebar; 1434 function sticky_sidebar() { 1435 1436 if ($('.is-sidebar-sticky #secondary').length) { 1437 jQuery.support.touch = 'ontouchend' in document; 1438 if (window.matchMedia("(min-width: 992px)").matches && !(jQuery.support.touch) && ($('#primary').height() > $('#secondary').height())) { 1439 1440 stickySidebar = new StickySidebar('#secondary', { 1441 topSpacing: 80, 1442 bottomSpacing: 20, 1443 resizeSensor: true, 1444 containerSelector: '.site-main > div', 1445 innerWrapperSelector: '.sidebar-wrap' 1446 }); 1447 1448 } 1449 } 1450 } 1451 // ------------------------------ 1452 1453 1454 // ------------------------------ 1455 // UPDATE STICKY SIDEBAR 1456 function sticky_sidebar_update() { 1457 if ($('.is-sidebar-sticky #secondary').length) { 1458 jQuery.support.touch = 'ontouchend' in document; 1459 if (window.matchMedia("(min-width: 992px)").matches && !(jQuery.support.touch) && ($('#primary').height() > $('#secondary').height())) { 1460 1461 stickySidebar.updateSticky(); 1462 1463 } 1464 // fix for : sticky sidebar overlap when resized to mobile view 1465 if (window.matchMedia("(max-width: 991px)").matches) { 1466 1467 if (stickySidebar) { 1468 stickySidebar.destroy(); 1469 } 1470 1471 } 1472 } 1473 } 1474 // ------------------------------ 1475 1476 1477 // ------------------------------ 1478 // FULL SCREEN BG VIDEO 1479 function bgVideo(fs_video) { 1480 1481 var videoW = fs_video.find('iframe, video').width(), 1482 videoH = fs_video.find('iframe, video').height(), 1483 screenW = $('.intro').outerWidth(), 1484 screenH = $('.intro').outerHeight(); 1485 1486 var video_ratio = videoW / videoH; 1487 var screen_ratio = screenW / screenH; 1488 1489 if (video_ratio > screen_ratio) { 1490 var diffW = screenH / videoH; 1491 var newWidth = videoW * diffW; 1492 fs_video.css({ 'width': newWidth, 'margin-left': -((newWidth - screenW) / 2), 'margin-top': 0 }); 1493 } else { 1494 var diffH = screenH / videoH; 1495 var newHeight = screenH * diffH; 1496 fs_video.css({ 'width': "100%", 'margin-left': 0, 'margin-top': -((videoH - screenH) / 2) }); 1497 } 1498 } 1499 // ------------------------------ 1500 1501 1502 1503 // ------------------------------ 1504 // FULL WIDTH PARALLAX IMAGES 1505 function parallaxImages() { 1506 $('img.parallax').each(function (index, element) { 1507 1508 var img = $(element); 1509 $('<div class="parallax-image"></div>').insertBefore(img); 1510 var wrapper = img.prev('.parallax-image'); 1511 wrapper.css('background-image', 'url(' + img.attr('src') + ')'); 1512 1513 if (img.hasClass('half')) { 1514 wrapper.addClass('half'); 1515 } 1516 1517 var isIE = document.documentMode || /Edge/.test(navigator.userAgent); 1518 if (!isIE) { 1519 img.imagesLoaded(function () { 1520 1521 // PARALLAX EFFECT 1522 var aspect_ratio = img.width() / img.height(); 1523 var speed = aspect_ratio > 1.2 ? 0.2 : -0.9; 1524 speed = $('.content-area').hasClass('with-sidebar') ? 0.2 : speed; 1525 wrapper.jarallax({ 1526 zIndex: 1, 1527 speed: speed, 1528 disableParallax: function () { 1529 return /iPad|iPhone|iPod|Edge|Trident|Android/.test(navigator.userAgent); 1530 } 1531 });
1532 1533 }); 1534 } 1535 }); 1536 } 1537 // ------------------------------ 1538 1539 1540 1541 1542 // ------------------------------ 1543 // FluidBox : Zoomable Images 1544 function setupFluidbox() { 1545 1546 $('.entry-content > p a, .wp-caption a, a.zoom').each(function () { 1547 1548 // prevent conflict with the woocommerce lightbox - both have zoom class 1549 if ($('body').hasClass('woocommerce')) { 1550 return; 1551 } 1552 if ($(this).attr('href').match(/\.(jpeg|jpg|gif|png)$/) !== null) { 1553 $(this).fluidbox({ 1554 viewportFill: 0.8, 1555 immediateOpen: true, 1556 loader: false, 1557 stackIndex: 400 1558 }); 1559 } 1560 }); 1561 } 1562 // ------------------------------ 1563 1564 1565 1566 // ------------------------------ 1567 // GALLERY COLLAGE LAYOUT 1568 function collage() { 1569 var collage = $('.gallery'); 1570 if (collage.length) { 1571 1572 collage.each(function (index, el) { 1573 1574 // wait for images to be loaded 1575 $(el).imagesLoaded(function () { 1576 1577 $(el).removeClass('pw-collage-loading').addClass('has-collage-layout'); 1578 $(el).collagePlus({ 1579 1580 //'targetHeight' : collage.data('row-height'), 1581 'targetHeight': 360, 1582 'effect': 'effect-4', 1583 'allowPartialLastRow': false 1584 1585 }); //collagePlus() 1586 1587 }); //imagesLoaded() 1588 1589 }); //each 1590 } 1591 } 1592 // ------------------------------ 1593 1594 1595 1596 // ------------------------------ 1597 // MASONRY LAYOUT : changes the number of masonry columns based on the current container's width 1598 function setMasonry() { 1599 1600 var itemW = $masonry_container.data('item-width'); 1601 var containerW = $masonry_container.width(); 1602 var items = $masonry_container.children('.hentry'); 1603 var columns = Math.round(containerW / itemW); 1604 $masonry_container.removeClass('col-1 col-2 col-3 col-4- col-5 col-6 col-7- col-8').addClass('col-' + columns); 1605 1606 // set the widths (%) for each of item 1607 items.each(function (index, element) { 1608 var multiplier = ($masonry_container.hasClass('first-full') && index === 0) && columns > 1 ? 2 : 1; 1609 var itemRealWidth = (Math.floor(containerW / columns) * 100 / containerW) * multiplier; 1610 itemRealWidth = itemRealWidth > 100 ? 100 : itemRealWidth; 1611 $(this).css('width', itemRealWidth + '%'); 1612 }); 1613 1614 var columnWidth = Math.floor(containerW / columns); 1615 $masonry_container.isotope('option', { masonry: { columnWidth: columnWidth } }); 1616 } 1617 // ------------------------------ 1618 1619 1620 1621})(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.