1jQuery(function ($) { 2 var $body = $('body'), 3 $window = $(window); 4 5 $(document).ready(function () { 6 $(".eds_pageLoader").fadeOut("slow"); 7 $(".EasyDNNSkin_Ozone2").addClass("eds_contentLoaded"); 8 if ($window.scrollTop() == 0) 9 $body.removeClass('eds_pageScrolled'); 10 else 11 $body.addClass('eds_pageScrolled'); 12 }); 13 14 $window.on('scroll', function () { 15 if ($window.scrollTop() == 0) 16 $body.removeClass('eds_pageScrolled'); 17 else 18 $body.addClass('eds_pageScrolled'); 19 }); 20 21 smoothScroll.init({ 22 selector: '.eds_scrollTo' 23 }); 24 25 $(".eds_searchButton").click(function () { 26 $(".eds_searchContainer").toggleClass("eds_searchVisible"); 27 }); 28 $(".eds_searchClose").click(function () { 29 $(".eds_searchContainer").removeClass("eds_searchVisible"); 30 }); 31 $(".eds_pushContent .eds_sideHeaderTriger").click(function () { 32 $("body").toggleClass("eds_headerActive"); 33 }); 34 $(".eds_sideHeader6Triger").click(function () { 35 $(".eds_fixedSideHeader").toggleClass("eds_headerActive"); 36 }); 37 $(".eds_sideHeader6Close").click(function () { 38 $(".eds_fixedSideHeader").removeClass("eds_headerActive"); 39 }); 40 $('.eds_tabs').edsTabulator_1(); 41 $('.eds_accordion').edsAccordion_1(); 42 $('.eds_paralaxBackground').parallax({ 43 speed: 0.15 44 }); 45 $('.eds_paralaxBackground2').parallax({ 46 speed: 0.15 47 }); 48 $('.eds_headerHeight').headerSpacer(); 49 $('.eds__menuWrapper').headerSpacer(); 50 $('.responsAbilityMenu').responsAbilityMenu(); 51 52 if ($('.edsBB__save').length < 1) { 53 $('.pulseOnView').addClass("eds_hidden").viewportChecker({ 54 classToAdd: 'eds_visible animated pulse', 55 offset: 100 56 }); 57 $('.tadaOnView').addClass("eds_hidden").viewportChecker({ 58 classToAdd: 'eds_visible animated tada', 59 offset: 100 60 }); 61 $('.fadeInOnView').addClass("eds_hidden").viewportChecker({ 62 classToAdd: 'eds_visible animated fadeIn', 63 offset: 100 64 }); 65 $('.fadeInDownOnView').addClass("eds_hidden").viewportChecker({ 66 classToAdd: 'eds_visible animated fadeInDown', 67 offset: 100 68 }); 69 $('.fadeInLeftOnView').addClass("eds_hidden").viewportChecker({ 70 classToAdd: 'eds_visible animated fadeInLeft', 71 offset: 100 72 }); 73 $('.fadeInLeftBigOnView').addClass("eds_hidden").viewportChecker({ 74 classToAdd: 'eds_visible animated fadeInLeftBig', 75 offset: 100 76 }); 77 $('.fadeInRightOnView').addClass("eds_hidden").viewportChecker({ 78 classToAdd: 'eds_visible animated fadeInRight', 79 offset: 100 80 }); 81 $('.fadeInRightBigOnView').addClass("eds_hidden").viewportChecker({ 82 classToAdd: 'eds_visible animated fadeInRightBig', 83 offset: 100 84 }); 85 $('.fadeInUpOnView').addClass("eds_hidden").viewportChecker({ 86 classToAdd: 'eds_visible animated fadeInUp', 87 offset: 100 88 }); 89 $('.fadeInUpBigOnView').addClass("eds_hidden").viewportChecker({ 90 classToAdd: 'eds_visible animated fadeInUpBig', 91 offset: 100 92 }); 93 $('.flipInXOnView').addClass("eds_hidden").viewportChecker({ 94 classToAdd: 'eds_visible animated flipInX', 95 offset: 100 96 }); 97 $('.flipInYOnView').addClass("eds_hidden").viewportChecker({ 98 classToAdd: 'eds_visible animated flipInY', 99 offset: 100 100 }); 101 $('.lightSpeedInOnView').addClass("eds_hidden").viewportChecker({ 102 classToAdd: 'eds_visible animated lightSpeedIn', 103 offset: 100 104 }); 105 $('.rotateInOnView').addClass("eds_hidden").viewportChecker({ 106 classToAdd: 'eds_visible animated rotateIn', 107 offset: 100 108 }); 109 $('.rotateInDownLeftOnView').addClass("eds_hidden").viewportChecker({ 110 classToAdd: 'eds_visible animated rotateInDownLeft', 111 offset: 100 112 }); 113 $('.rotateInDownRightOnView').addClass("eds_hidden").viewportChecker({ 114 classToAdd: 'eds_visible animated rotateInDownRight', 115 offset: 100 116 }); 117 $('.rotateInUpLeftOnView').addClass("eds_hidden").viewportChecker({ 118 classToAdd: 'eds_visible animated rotateInUpLeft', 119 offset: 100 120 }); 121 $('.rotateInUpRightOnView').addClass("eds_hidden").viewportChecker({ 122 classToAdd: 'eds_visible animated rotateInUpRight', 123 offset: 100 124 }); 125 $('.slideInDownOnView').addClass("eds_hidden").viewportChecker({ 126 classToAdd: 'eds_visible animated slideInDown', 127 offset: 100 128 }); 129 $('.slideInLeftOnView').addClass("eds_hidden").viewportChecker({ 130 classToAdd: 'eds_visible animated slideInLeft', 131 offset: 100 132 }); 133 $('.slideInRightOnView').addClass("eds_hidden").viewportChecker({ 134 classToAdd: 'eds_visible animated slideInRight', 135 offset: 100 136 }); 137 }; 138 139 $('.eds_counter').viewportChecker({ 140 offset: 100, 141 classToAdd: '', 142 callbackFunction: function ($el, action) { 143 var counterActivated = 'counterActivated'; 144 145 if ($el.data(counterActivated)) 146 return; 147 148 $el.data(counterActivated, true); 149 150 $el 151 .prop('Counter', 0) 152 .animate( 153 { 154 Counter: $el.text() 155 }, 156 { 157 duration: 2000,
158 step: function (now) { 159 $el.text(Math.ceil(now)); 160 } 161 } 162 ); 163 } 164 }); 165 166 $('.eds_progressAnimated').addClass("eds_nullValue").viewportChecker({ 167 classToRemove: 'eds_nullValue', 168 offset: 100 169 }); 170 171 $('.eds_floatingMenu') 172 .on('click', '> span', function () { 173 $(this).parent().toggleClass('eds_floatingMenuActive'); 174 }) 175 .filter('.eds_onClickCloseMenu') 176 .on('click', '> ul > li a.edsfnl_action', function () { 177 $(this).parents('.eds_floatingMenu > ul').eq(0).parent().removeClass("eds_floatingMenuActive"); 178 }); 179 180 $('.eds__boxImage').each(function (key, imgTag) { 181 var $boxBackgroundSrc = $(imgTag).attr('src'); 182 $(imgTag).parent().css('background-image', 'url(' + $boxBackgroundSrc + ')'); 183 $(imgTag).addClass('eds_hidden'); 184 }); 185 186 function simetricBox() { 187 $(".eds__simetricBox").each(function () { 188 $(this).height($(this).width()); 189 }); 190 } 191 192 $(document).ready(function () { 193 simetricBox(); 194 }); 195 $(window).on("resize", function () { 196 simetricBox(); 197 }); 198 199}); 200 201// Hide Header on on scroll down --------------------------------------------------------------------------------------- 202 203(function () { 204 var didScroll; 205 var lastScrollTop = 0; 206 var delta = 150; 207 var navbarHeight = $('.eds_animatedHeader').outerHeight(); 208 209 $(window).scroll(function (event) { 210 didScroll = true; 211 }); 212 213 setInterval(function () { 214 if (didScroll) { 215 hasScrolled(); 216 didScroll = false; 217 } 218 }, 250); 219 220 function hasScrolled() { 221 var st = $(this).scrollTop(); 222 223 // Make sure they scroll more than delta 224 if (Math.abs(lastScrollTop - st) <= delta) 225 return; 226 227 // If they scrolled down and are past the navbar, add class .nav-up. 228 // This is necessary so you never see what is "behind" the navbar. 229 if (st > lastScrollTop && st > navbarHeight) { 230 // Scroll Down 231 $('.eds_animatedHeader').removeClass('eds_headerDow').addClass('eds_headerUp'); 232 } else { 233 // Scroll Up 234 if (st + $(window).height() < $(document).height()) { 235 $('.eds_animatedHeader').removeClass('eds_headerUp').addClass('eds_headerDow'); 236 } 237 } 238 239 lastScrollTop = st; 240 } 241})(); 242 243// end of Hide Header on on scroll down -------------------------------------------------------------------------------- 244 245// responsAbilityInstance ---------------------------------------------------------------------------------------------- 246 247(function ($) { 248 var menuInstanceKey = 'responsAbilityInstance', 249 $window = $(window); 250 251 $.fn.responsAbilityMenu = function () { 252 return this.each(function () { 253 var $mainWrapper = $(this), 254 $menuWrapper = $('> .raMenuWrapper', $mainWrapper), 255 $menuTriggerWrapper = $('> .raMenuTriggerWrapper', $mainWrapper), 256 $placeholder = $mainWrapper.next('.responsAbilityMenuPlaceholder'), 257 258 offsetTop, 259 formTopMargin = parseInt($('#Form').css('marginTop'), 10), 260 261 resizeMenu = function () { 262 var maxHeight = $window.height() - $menuTriggerWrapper.outerHeight(true), 263 windowScrollTop; 264 265 if ($menuTriggerWrapper.is(':hidden') || !$mainWrapper.hasClass(menuOpenedClass)) 266 return; 267 268 maxHeight -= $mainWrapper.outerHeight(true) - $mainWrapper.height(); 269 270 windowScrollTop = $window.scrollTop(); 271 272 if (offsetTop > windowScrollTop) 273 maxHeight = maxHeight - formTopMargin - (offsetTop - windowScrollTop); 274 275 $menuWrapper.css('maxHeight', maxHeight + 'px'); 276 }, 277 278 updateOffsetTop = function () { 279 if ($mainWrapper.hasClass('raFixedMenu')) 280 return; 281 282 offsetTop = $mainWrapper.offset().top - parseFloat($mainWrapper.css('marginTop')) - formTopMargin; 283 }, 284 285 menuOpenedClass = 'raMenuOpened', 286 itemOpenedClass = 'raItemOpened', 287 openMenuItemTimerKey = 'raOpenMenuItemTimer', 288 isSideMenu = $mainWrapper.hasClass('sideMenu'); 289 290 if ($mainWrapper.data(menuInstanceKey)) 291 return; 292 293 $mainWrapper.data(menuInstanceKey, true); 294 295 updateOffsetTop(); 296 297 if ($placeholder.length > 0) 298 $placeholder.height($mainWrapper.outerHeight(true)); 299 300 $mainWrapper 301 .on('click', '> .raMenuTriggerWrapper > .raMenuTrigger', function () { 302 $mainWrapper.toggleClass(menuOpenedClass); 303 304 resizeMenu(); 305 }) 306 .on('click', '> .raMenuWrapper .edsmm_childIndicator', function () { 307 $(this).parents('li').eq(0).toggleClass(itemOpenedClass) 308 }); 309 310 if ($mainWrapper.hasClass('hoverOpensItems')) 311 $mainWrapper 312 .on('mouseenter', '> .raMenuWrapper .edsmm_menuItem', function () { 313 var $this = $(this), 314 $siblings = $this.siblings('.edsmm_hasChild'); 315 316 $siblings = $siblings.add('.edsmm_menuItem.edsmm_hasChild', $siblings) 317 .each(function () { 318 clearTimeout($(this).data(openMenuItemTimerKey)); 319 }); 320 321 $this.data( 322 openMenuItemTimerKey, 323 setTimeout( 324 function () { 325 if ($this.hasClass('edsmm_hasChild')) 326 $this.addClass(itemOpenedClass); 327 328 $siblings.removeClass(itemOpenedClass); 329 }, 330 150 331 ) 332 ); 333 }); 334 335 if (isSideMenu) 336 $('> .raMenuWrapper .edsmm_menuItem.edsmm_active.edsmm_hasChild', $mainWrapper).addClass(itemOpenedClass); 337 else 338 $menuWrapper.on('mouseenter', '> ol > li.edsmm_megaMenu', function () { 339 var $container = $('> div', this); 340 341 if ($container.length == 0) 342 return; 343 344 var avalibleHeight = $window.height() - Math.ceil($container.offset().top) - 10; 345 346 $container.css('max-height', avalibleHeight + $window.scrollTop()); 347 }); 348 349 $window 350 .on('scroll', function () { 351 updateOffsetTop(); 352 353 resizeMenu(); 354 355 if ($placeholder.length == 0) 356 return; 357 358 if ($window.scrollTop() >= offsetTop) { 359 $mainWrapper 360 .addClass('raFixedMenu') 361 .css('marginTop', Math.abs(formTopMargin)); 362 363 $placeholder.addClass('show'); 364 } else { 365 $mainWrapper 366 .removeClass('raFixedMenu') 367 .css('marginTop', ''); 368 369 $placeholder.removeClass('show'); 370 } 371 }) 372 .on('resize', function () { 373 updateOffsetTop(); 374 375 resizeMenu(); 376 377 if ($menuTriggerWrapper.is(':hidden')) { 378 $mainWrapper.removeClass(menuOpenedClass); 379 $menuWrapper.css('maxHeight', ''); 380 } 381 }); 382 }); 383 }; 384})(jQuery); 385 386// end of responsAbilityInstance --------------------------------------------------------------------------------------- 387 388// edsTabulator -------------------------------------------------------------------------------------------------------- 389 390(function ($, window) { 391 var activeClass = 'edsTabulator_active', 392 tabTriggerSelector = '.edsTabulator_tabTrigger', 393 tabSelector = '.edsTabulator_tab'; 394 395 function edsTabulator(elem) { 396 var self = this, 397 $mainWrapper = $(elem); 398 399 $mainWrapper 400 .on('click', tabTriggerSelector, function () { 401 var $clicked = $(this), 402 itemIndex = $clicked.index(), 403 $tabContentWrappers = $('.edsTabulator_tabsWrapper .edsTabulator_tab', $mainWrapper); 404 405 if ($clicked.hasClass(activeClass)) 406 return; 407 408 $tabContentWrappers.removeClass(activeClass); 409 $(tabTriggerSelector, $mainWrapper).removeClass(activeClass); 410 411 $clicked.addClass(activeClass); 412 $tabContentWrappers.eq(itemIndex).addClass(activeClass); 413 }); 414 415 if ($(tabTriggerSelector + '.' + activeClass, $mainWrapper).length == 0) { 416 $(tabSelector + '.' + activeClass, $mainWrapper).removeClass(activeClass); 417 418 $(tabTriggerSelector, $mainWrapper).eq(0).addClass(activeClass); 419 $(tabSelector, $mainWrapper).eq(0).addClass(activeClass); 420 } 421 } 422 423 edsTabulator.prototype = {}; 424 425 $.fn.edsTabulator_1 = function () { 426 var instanceKey = 'edsTabulatorRun'; 427 428 return this.each(function () { 429 var self = this; 430 431 if (!$.data(self, instanceKey)) 432 $.data(self, instanceKey, new edsTabulator(self)); 433 }); 434 }; 435 436})(jQuery, window); 437 438//end of edsTabulator -------------------------------------------------------------------------------------------------- 439 440// edsAccordion -------------------------------------------------------------------------------------------------------- 441 442(function ($, window) { 443 var activeClass = 'edsAccordion_active', 444 sectionClass = 'edsAccordion_section', 445 sectionContentWrapper = 'edsAccordion_contentWrapper'; 446 447 function edsAccordion(elem) { 448 var self = this, 449 $mainWrapper = $(elem); 450 451 $mainWrapper 452 .on('click', '.' + sectionClass + ' > .edsAccordion_title', function (e) { 453 var $clicked = $(this), 454 $section = $clicked.parent(), 455 $sectionContentWrapper = $('> .' + sectionContentWrapper, $section), 456 $activeSections = $('.' + sectionClass + '.' + activeClass, $mainWrapper), 457 currentlyActive = $section.hasClass(activeClass); 458 $('> .' + sectionContentWrapper, $activeSections) 459 .stop(true) 460 .animate( 461 { 462 height: 0 463 }, 464 { 465 duration: 200, 466 complete: function () { 467 $sectionContentWrapper.css('height', '0'); 468 } 469 } 470 ); 471 $activeSections.removeClass(activeClass); 472 473 if (currentlyActive) 474 return false;
475 476 $sectionContentWrapper 477 .stop(true) 478 .animate( 479 { 480 height: $('> .edsAccordion_content', $sectionContentWrapper).outerHeight(true) 481 }, 482 { 483 duration: 200, 484 complete: function () { 485 $sectionContentWrapper.css('height', 'auto'); 486 } 487 } 488 ); 489 $section.addClass(activeClass); 490 491 return false; 492 }); 493 } 494 495 edsAccordion.prototype = {}; 496 497 $.fn.edsAccordion_1 = function () { 498 var instanceKey = 'edsAccordionRun'; 499 500 return this.each(function () { 501 var elem = this; 502 503 if (!$.data(elem, instanceKey)) 504 $.data(elem, instanceKey, new edsAccordion(elem)); 505 }); 506 }; 507 508})(jQuery, window); 509 510// end of edsAccordion ------------------------------------------------------------------------------------------------- 511 512// jQuery Simple Parallax Plugin --------------------------------------------------------------------------------------- 513// Author: Heather Corey 514 515(function ($) { 516 517 $.fn.parallax = function (options) { 518 519 var windowHeight = $(window).height(); 520 521 // Establish default settings 522 var settings = $.extend({ 523 speed: 0.15 524 }, options); 525 526 // Iterate over each object in collection 527 return this.each(function () { 528 529 // Save a reference to the element 530 var $this = $(this); 531 532 // Set up Scroll Handler 533 $(document).scroll(function () { 534 535 var scrollTop = $(window).scrollTop(); 536 var offset = $this.offset().top; 537 var height = $this.outerHeight(); 538 539 // Check if above or below viewport 540 if (offset + height <= scrollTop || offset >= scrollTop + windowHeight) { 541 return; 542 } 543 544 var yBgPosition = Math.round((offset - scrollTop) * settings.speed); 545
546 // Apply the Y Background Position to Set the Parallax Effect 547 $this.css('background-position', 'center ' + yBgPosition + 'px'); 548 549 }); 550 }); 551 } 552}(jQuery)); 553 554// end of jQuery Simple Parallax Plugin -------------------------------------------------------------------------------- 555 556// viewportChecker ----------------------------------------------------------------------------------------------------- 557 558/* 559 The MIT License (MIT) 560 561 Copyright (c) 2014 Dirk Groenen 562 563 Permission is hereby granted, free of charge, to any person obtaining a copy of 564 this software and associated documentation files (the "Software"), to deal in 565 the Software without restriction, including without limitation the rights to 566 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 567 the Software, and to permit persons to whom the Software is furnished to do so, 568 subject to the following conditions: 569 570 The above copyright notice and this permission notice shall be included in all 571 copies or substantial portions of the Software. 572*/ 573 574(function ($) { 575 $.fn.viewportChecker = function (useroptions) { 576 if ($(this).length > 0 && $(this).hasClass('edsBB_ProgressTemp')) 577 return; 578 // Define options and extend with user 579 var options = { 580 classToAdd: 'visible', 581 classToRemove: 'invisible', 582 classToAddForFullView: 'full-visible', 583 removeClassAfterAnimation: false, 584 offset: 100, 585 repeat: false, 586 invertBottomOffset: true, 587 callbackFunction: function (elem, action) { }, 588 scrollHorizontal: false, 589 scrollBox: window 590 }; 591 $.extend(options, useroptions); 592 593 // Cache the given element and height of the browser 594 var $elem = this, 595 boxSize = { height: $(options.scrollBox).height(), width: $(options.scrollBox).width() }; 596 597 /* 598 * Main method that checks the elements and adds or removes the class(es) 599 */ 600 this.checkElements = function () { 601 var viewportStart, viewportEnd; 602 603 // Set some vars to check with 604 if (!options.scrollHorizontal) { 605 viewportStart = Math.max( 606 $('html').scrollTop(), 607 $('body').scrollTop(), 608 $(window).scrollTop() 609 ); 610 viewportEnd = (viewportStart + boxSize.height); 611 } 612 else { 613 viewportStart = Math.max( 614 $('html').scrollLeft(), 615 $('body').scrollLeft(), 616 $(window).scrollLeft() 617 ); 618 viewportEnd = (viewportStart + boxSize.width); 619 } 620 621 // Loop through all given dom elements 622 $elem.each(function () { 623 var $obj = $(this), 624 objOptions = {}, 625 attrOptions = {}; 626 627 // Get any individual attribution data 628 if ($obj.data('vp-add-class')) 629 attrOptions.classToAdd = $obj.data('vp-add-class'); 630 if ($obj.data('vp-remove-class')) 631 attrOptions.classToRemove = $obj.data('vp-remove-class'); 632 if ($obj.data('vp-add-class-full-view')) 633 attrOptions.classToAddForFullView = $obj.data('vp-add-class-full-view'); 634 if ($obj.data('vp-keep-add-class')) 635 attrOptions.removeClassAfterAnimation = $obj.data('vp-remove-after-animation'); 636 if ($obj.data('vp-offset')) 637 attrOptions.offset = $obj.data('vp-offset'); 638 if ($obj.data('vp-repeat')) 639 attrOptions.repeat = $obj.data('vp-repeat'); 640 if ($obj.data('vp-scrollHorizontal')) 641 attrOptions.scrollHorizontal = $obj.data('vp-scrollHorizontal'); 642 if ($obj.data('vp-invertBottomOffset')) 643 attrOptions.scrollHorizontal = $obj.data('vp-invertBottomOffset'); 644 645 // Extend objOptions with data attributes and default options 646 $.extend(objOptions, options); 647 $.extend(objOptions, attrOptions); 648 649 // If class already exists; quit 650 if ($obj.data('vp-animated') && !objOptions.repeat) { 651 return; 652 } 653 654 // Check if the offset is percentage based 655 if (String(objOptions.offset).indexOf("%") > 0) 656 objOptions.offset = (parseInt(objOptions.offset) / 100) * boxSize.height; 657 658 // Get the raw start and end positions 659 var rawStart = (!objOptions.scrollHorizontal) ? $obj.offset().top : $obj.offset().left, 660 rawEnd = (!objOptions.scrollHorizontal) ? rawStart + $obj.height() : rawStart + $obj.width(); 661 662 // Add the defined offset 663 var elemStart = Math.round(rawStart) + objOptions.offset, 664 elemEnd = (!objOptions.scrollHorizontal) ? elemStart + $obj.height() : elemStart + $obj.width(); 665 666 if (objOptions.invertBottomOffset) 667 elemEnd -= (objOptions.offset * 2); 668 669 // Add class if in viewport 670 if ((elemStart < viewportEnd) && (elemEnd > viewportStart)) { 671 672 // Remove class 673 $obj.removeClass(objOptions.classToRemove); 674 $obj.addClass(objOptions.classToAdd); 675 676 // Do the callback function. Callback wil send the jQuery object as parameter 677 objOptions.callbackFunction($obj, "add"); 678 679 // Check if full element is in view 680 if (rawEnd <= viewportEnd && rawStart >= viewportStart) 681 $obj.addClass(objOptions.classToAddForFullView); 682 else 683 $obj.removeClass(objOptions.classToAddForFullView); 684 685 // Set element as already animated 686 $obj.data('vp-animated', true); 687 688 if (objOptions.removeClassAfterAnimation) { 689 $obj.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () { 690 $obj.removeClass(objOptions.classToAdd); 691 }); 692 } 693 694 // Remove class if not in viewport and repeat is true 695 } else if ($obj.hasClass(objOptions.classToAdd) && (objOptions.repeat)) { 696 $obj.removeClass(objOptions.classToAdd + " " + objOptions.classToAddForFullView); 697 698 // Do the callback function. 699 objOptions.callbackFunction($obj, "remove"); 700 701 // Remove already-animated-flag 702 $obj.data('vp-animated', false); 703 } 704 }); 705 706 }; 707 708 /** 709 * Binding the correct event listener is still a tricky thing. 710 * People have expierenced sloppy scrolling when both scroll and touch 711 * events are added, but to make sure devices with both scroll and touch 712 * are handles too we always have to add the window.scroll event 713 *
714 * @see https://github.com/dirkgroenen/jQuery-viewport-checker/issues/25 715 * @see https://github.com/dirkgroenen/jQuery-viewport-checker/issues/27 716 */ 717 718 // Select the correct events 719 if ('ontouchstart' in window || 'onmsgesturechange' in window) { 720 // Device with touchscreen 721 $(document).bind("touchmove MSPointerMove pointermove", this.checkElements); 722 } 723 724 // Always load on window load 725 $(options.scrollBox).bind("load scroll", this.checkElements); 726 727 // On resize change the height var 728 $(window).resize(function (e) { 729 boxSize = { height: $(options.scrollBox).height(), width: $(options.scrollBox).width() }; 730 $elem.checkElements(); 731 }); 732 733 // trigger inital check if elements already visible 734 this.checkElements(); 735 736 // Default jquery plugin behaviour 737 return this; 738 }; 739})(jQuery); 740 741// end of viewportChecker ---------------------------------------------------------------------------------------------- 742 743// headerSpacerInstance ------------------------------------------------------------------------------------------------ 744 745(function ($) { 746 var instanceKey = 'headerSpacerInstance', 747 $window = $(window); 748 749 $.fn.headerSpacer = function () { 750 return this.each(function () { 751 var $mainWrapper = $(this), 752 $placeholder = $($mainWrapper.data('placeholderSelector')), 753 align = function () { 754 $placeholder.height($mainWrapper.outerHeight(true)); 755 }; 756 757 if ($mainWrapper.data(instanceKey)) 758 return; 759 760 $mainWrapper.data(instanceKey, true); 761 762 $(document).ready(function ($) { 763 align(); 764 setTimeout( 765 function () { 766 align(); 767 }, 768 1500 769 ); 770 }); 771 772 $window 773 .on('scroll', function () { 774 align(); 775 setTimeout( 776 function () { 777 align(); 778 }, 779 600 780 ); 781 }) 782 .on('resize', function () { 783 align(); 784 setTimeout( 785 function () { 786 align(); 787 }, 788 600 789 ); 790 }); 791 }); 792 }; 793})(jQuery); 794 795// end of headerSpacerInstance ----------------------------------------------------------------------------------------- 796 797// backToTop fadeIn-fadeOut -------------------------------------------------------------------------------------------- 798 799jQuery(document).ready(function ($) { 800 // browser window scroll (in pixels) after which the "back to top" link is shown 801 var offset = 500, 802 //browser window scroll (in pixels) after which the "back to top" link opacity is reduced 803 offset_opacity = 1200, 804 //duration of the top scrolling animation (in ms) 805 scroll_top_duration = 700, 806 //grab the "back to top" link 807 $back_to_top = $('.eds_backToTop'); 808 809 //hide or show the "back to top" link 810 $(window).scroll(function () { 811 ($(this).scrollTop() > offset) ? $back_to_top.addClass('eds_backToTopVisible') : $back_to_top.removeClass('eds_backToTopVisible eds_backToTopFadeOut'); 812 if ($(this).scrollTop() > offset_opacity) { 813 $back_to_top.addClass('eds_backToTopFadeOut'); 814 } 815 }); 816 817}); 818 819// end of backToTop fadeIn-fadeOut ------------------------------------------------------------------------------------- 820 821// smoothScroll -------------------------------------------------------------------------------------------------------- 822 823(function (root, factory) { 824 if (typeof define === 'function' && define.amd) { 825 define([], factory(root)); 826 } else if (typeof exports === 'object') { 827 module.exports = factory(root); 828 } else { 829 root.smoothScroll = factory(root); 830 } 831})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) { 832 833 'use strict'; 834 835 // 836 // Variables 837 // 838 839 var smoothScroll = {}; // Object for public APIs 840 var supports = 'querySelector' in document && 'addEventListener' in root; // Feature test 841 var settings, eventTimeout, fixedHeader, headerHeight; 842 843 // Default settings 844 var defaults = { 845 selector: '[data-scroll]', 846 selectorHeader: '[data-scroll-header]', 847 speed: 500, 848 easing: 'easeInOutCubic', 849 offset: 0, 850 updateURL: true, 851 callback: function () { } 852 }; 853 854 855 // 856 // Methods 857 // 858 859 /** 860 * Merge two or more objects. Returns a new object. 861 * @private 862 * @param {Boolean} deep If true, do a deep (or recursive) merge [optional] 863 * @param {Object} objects The objects to merge together 864 * @returns {Object} Merged values of defaults and options 865 */ 866 var extend = function () { 867 868 // Variables 869 var extended = {}; 870 var deep = false;
871 var i = 0; 872 var length = arguments.length; 873 874 // Check if a deep merge 875 if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') { 876 deep = arguments[0]; 877 i++; 878 } 879 880 // Merge the object into the extended object 881 var merge = function (obj) { 882 for (var prop in obj) { 883 if (Object.prototype.hasOwnProperty.call(obj, prop)) { 884 // If deep merge and property is an object, merge properties 885 if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') { 886 extended[prop] = extend(true, extended[prop], obj[prop]); 887 } else { 888 extended[prop] = obj[prop]; 889 } 890 } 891 } 892 }; 893 894 // Loop through each object and conduct a merge 895 for (; i < length; i++) { 896 var obj = arguments[i]; 897 merge(obj); 898 } 899 900 return extended; 901 902 }; 903 904 /** 905 * Get the height of an element. 906 * @private 907 * @param {Node} elem The element to get the height of 908 * @return {Number} The element's height in pixels 909 */ 910 var getHeight = function (elem) { 911 return Math.max(elem.scrollHeight, elem.offsetHeight, elem.clientHeight); 912 }; 913 914 /** 915 * Get the closest matching element up the DOM tree. 916 * @private 917 * @param {Element} elem Starting element 918 * @param {String} selector Selector to match against (class, ID, data attribute, or tag) 919 * @return {Boolean|Element} Returns null if not match found 920 */ 921 var getClosest = function (elem, selector) { 922 923 // Variables 924 var firstChar = selector.charAt(0); 925 var supports = 'classList' in document.documentElement; 926 var attribute, value; 927 928 // If selector is a data attribute, split attribute from value 929 if (firstChar === '[') { 930 selector = selector.substr(1, selector.length - 2); 931 attribute = selector.split('='); 932 933 if (attribute.length > 1) { 934 value = true; 935 attribute[1] = attribute[1].replace(/"/g, '').replace(/'/g, ''); 936 } 937 } 938 939 // Get closest match 940 for (; elem && elem !== document; elem = elem.parentNode) { 941 942 // If selector is a class 943 if (firstChar === '.') { 944 if (supports) { 945 if (elem.classList.contains(selector.substr(1))) { 946 return elem; 947 } 948 } else { 949 if (new RegExp('(^|\\s)' + selector.substr(1) + '(\\s|$)').test(elem.className)) { 950 return elem; 951 } 952 } 953 } 954 955 // If selector is an ID 956 if (firstChar === '#') { 957 if (elem.id === selector.substr(1)) { 958 return elem; 959 } 960 } 961 962 // If selector is a data attribute 963 if (firstChar === '[') { 964 if (elem.hasAttribute(attribute[0])) { 965 if (value) { 966 if (elem.getAttribute(attribute[0]) === attribute[1]) { 967 return elem; 968 } 969 } else { 970 return elem; 971 } 972 } 973 } 974 975 // If selector is a tag 976 if (elem.tagName.toLowerCase() === selector) { 977 return elem; 978 } 979 980 } 981 982 return null; 983 984 }; 985 986 /** 987 * Escape special characters for use with querySelector 988 * @private 989 * @param {String} id The anchor ID to escape 990 * @author Mathias Bynens 991 * @link https://github.com/mathiasbynens/CSS.escape 992 */ 993 var escapeCharacters = function (id) { 994 var string = String(id); 995 var length = string.length; 996 var index = -1; 997 var codeUnit; 998 var result = ''; 999 var firstCodeUnit = string.charCodeAt(0); 1000 while (++index < length) { 1001 codeUnit = string.charCodeAt(index); 1002 // Note: thereâs no need to special-case astral symbols, surrogate 1003 // pairs, or lone surrogates. 1004 1005 // If the character is NULL (U+0000), then throw an 1006 // `InvalidCharacterError` exception and terminate these steps. 1007 if (codeUnit === 0x0000) { 1008 throw new InvalidCharacterError( 1009 'Invalid character: the input contains U+0000.' 1010 ); 1011 } 1012 1013 if ( 1014 // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is 1015 // U+007F, [â¦] 1016 (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F || 1017 // If the character is the first character and is in the range [0-9] 1018 // (U+0030 to U+0039), [â¦] 1019 (index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) || 1020 // If the character is the second character and is in the range [0-9] 1021 // (U+0030 to U+0039) and the first character is a `-` (U+002D), [â¦] 1022 ( 1023 index === 1 && 1024 codeUnit >= 0x0030 && codeUnit <= 0x0039 && 1025 firstCodeUnit === 0x002D 1026 ) 1027 ) { 1028 // http://dev.w3.org/csswg/cssom/#escape-a-character-as-code-point 1029 result += '\\' + codeUnit.toString(16) + ' '; 1030 continue; 1031 } 1032 1033 // If the character is not handled by one of the above rules and is 1034 // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or 1035 // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to 1036 // U+005A), or [a-z] (U+0061 to U+007A), [â¦] 1037 if ( 1038 codeUnit >= 0x0080 || 1039 codeUnit === 0x002D || 1040 codeUnit === 0x005F || 1041 codeUnit >= 0x0030 && codeUnit <= 0x0039 || 1042 codeUnit >= 0x0041 && codeUnit <= 0x005A || 1043 codeUnit >= 0x0061 && codeUnit <= 0x007A 1044 ) { 1045 // the character itself 1046 result += string.charAt(index); 1047 continue; 1048 } 1049 1050 // Otherwise, the escaped character. 1051 // http://dev.w3.org/csswg/cssom/#escape-a-character 1052 result += '\\' + string.charAt(index); 1053 1054 } 1055 return result; 1056 }; 1057 1058 /** 1059 * Calculate the easing pattern 1060 * @private 1061 * @link https://gist.github.com/gre/1650294 1062 * @param {String} type Easing pattern 1063 * @param {Number} time Time animation should take to complete 1064 * @returns {Number} 1065 */ 1066 var easingPattern = function (type, time) { 1067 var pattern; 1068 if (type === 'easeInQuad') pattern = time * time; // accelerating from zero velocity 1069 if (type === 'easeOutQuad') pattern = time * (2 - time); // decelerating to zero velocity 1070 if (type === 'easeInOutQuad') pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * t
1070ime) * time; // acceleration until halfway, then deceleration 1071 if (type === 'easeInCubic') pattern = time * time * time; // accelerating from zero velocity 1072 if (type === 'easeOutCubic') pattern = (--time) * time * time + 1; // decelerating to zero velocity 1073 if (type === 'easeInOutCubic') pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration 1074 if (type === 'easeInQuart') pattern = time * time * time * time; // accelerating from zero velocity 1075 if (type === 'easeOutQuart') pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity 1076 if (type === 'easeInOutQuart') pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration 1077 if (type === 'easeInQuint') pattern = time * time * time * time * time; // accelerating from zero velocity 1078 if (type === 'easeOutQuint') pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity 1079 if (type === 'easeInOutQuint') pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration 1080 return pattern || time; // no easing, no acceleration 1081 }; 1082 1083 /** 1084 * Calculate how far to scroll 1085 * @private 1086 * @param {Element} anchor The anchor element to scroll to 1087 * @param {Number} headerHeight Height of a fixed header, if any 1088 * @param {Number} offset Number of pixels by which to offset scroll 1089 * @returns {Number} 1090 */ 1091 var getEndLocation = function (anchor, headerHeight, offset) { 1092 var location = 0; 1093 if (anchor.offsetParent) { 1094 do { 1095 location += anchor.offsetTop; 1096 anchor = anchor.offsetParent; 1097 } while (anchor); 1098 } 1099 location = location - headerHeight - offset; 1100 return location >= 0 ? location : 0; 1101 }; 1102 1103 /** 1104 * Determine the document's height 1105 * @private 1106 * @returns {Number} 1107 */ 1108 var getDocumentHeight = function () { 1109 return Math.max( 1110 root.document.body.scrollHeight, root.document.documentElement.scrollHeight, 1111 root.document.body.offsetHeight, root.document.documentElement.offsetHeight, 1112 root.document.body.clientHeight, root.document.documentElement.clientHeight 1113 ); 1114 }; 1115 1116 /** 1117 * Convert data-options attribute into an object of key/value pairs 1118 * @private 1119 * @param {String} options Link-specific options as a data attribute string 1120 * @returns {Object} 1121 */ 1122 var getDataOptions = function (options) { 1123 return !options || !(typeof JSON === 'object' && typeof JSON.parse === 'function') ? {} : JSON.parse(options); 1124 }; 1125 1126 /** 1127 * Update the URL 1128 * @private 1129 * @param {Element} anchor The element to scroll to 1130 * @param {Boolean} url Whether or not to update the URL history 1131 */ 1132 var updateUrl = function (anchor, url) { 1133 if (root.history.pushState && (url || url === 'true') && root.location.protocol !== 'file:') { 1134 root.history.pushState(null, null, [root.location.protocol, '//', root.location.host, root.location.pathname, root.location.search, anchor].join('')); 1135 } 1136 }; 1137 1138 var getHeaderHeight = function (header) { 1139 return header === null ? 0 : (getHeight(header) + header.offsetTop); 1140 }; 1141 1142 /** 1143 * Start/stop the scrolling animation 1144 * @public 1145 * @param {Element} toggle The element that toggled the scroll event 1146 * @param {Element} anchor The element to scroll to 1147 * @param {Object} options 1148 */ 1149 smoothScroll.animateScroll = function (toggle, anchor, options) { 1150 1151 // Options and overrides 1152 var overrides = getDataOptions(toggle ? toggle.getAttribute('data-options') : null); 1153 var settings = extend(settings || defaults, options || {}, overrides); // Merge user options with defaults 1154 anchor = '#' + escapeCharacters(anchor.substr(1)); // Escape special characters and leading numbers 1155 1156 // Selectors and variables 1157 var anchorElem = anchor === '#' ? root.document.documentElement : root.document.querySelector(anchor); 1158 var startLocation = root.pageYOffset; // Current location on the page 1159 if (!fixedHeader) { fixedHeader = root.document.querySelector(settings.selectorHeader); } // Get the fixed header if not already set 1160 if (!headerHeight) { headerHeight = getHeaderHeight(fixedHeader); } // Get the height of a fixed header if one exists and not already set 1161 var endLocation = getEndLocation(anchorElem, headerHeight, parseInt(settings.offset, 10)); // Scroll to location 1162 var animationInterval; // interval timer 1163 var distance = endLocation - startLocation; // distance to travel 1164 var documentHeight = getDocumentHeight(); 1165 var timeLapsed = 0; 1166 var percentage, position; 1167 1168 // Update URL 1169 updateUrl(anchor, settings.updateURL); 1170 1171 /** 1172 * Stop the scroll animation when it reaches its target (or the bottom/top of page) 1173 * @private 1174 * @param {Number} position Current position on the page 1175 * @param {Number} endLocation Scroll to location 1176 * @param {Number} animationInterval How much to scroll on this loop 1177 */ 1178 var stopAnimateScroll = function (position, endLocation, animationInterval) { 1179 var currentLocation = root.pageYOffset; 1180 if (position == endLocation || currentLocation == endLocation || ((root.innerHe
1180ight + currentLocation) >= documentHeight)) { 1181 clearInterval(animationInterval); 1182 anchorElem.focus(); 1183 settings.callback(toggle, anchor); // Run callbacks after animation complete 1184 } 1185 }; 1186 1187 /** 1188 * Loop scrolling animation 1189 * @private 1190 */ 1191 var loopAnimateScroll = function () { 1192 timeLapsed += 16; 1193 percentage = (timeLapsed / parseInt(settings.speed, 10)); 1194 percentage = (percentage > 1) ? 1 : percentage; 1195 position = startLocation + (distance * easingPattern(settings.easing, percentage)); 1196 root.scrollTo(0, Math.floor(position)); 1197 stopAnimateScroll(position, endLocation, animationInterval); 1198 }; 1199 1200 /** 1201 * Set interval timer 1202 * @private 1203 */ 1204 var startAnimateScroll = function () { 1205 animationInterval = setInterval(loopAnimateScroll, 16); 1206 }; 1207 1208 /** 1209 * Reset position to fix weird iOS bug 1210 * @link https://github.com/cferdinandi/smooth-scroll/issues/45 1211 */ 1212 if (root.pageYOffset === 0) { 1213 root.scrollTo(0, 0); 1214 } 1215 1216 // Start scrolling animation 1217 startAnimateScroll(); 1218 1219 }; 1220 1221 /** 1222 * If smooth scroll element clicked, animate scroll 1223 * @private 1224 */ 1225 var eventHandler = function (event) { 1226 var toggle = getClosest(event.target, settings.selector); 1227 if (toggle && toggle.tagName.toLowerCase() === 'a') { 1228 event.preventDefault(); // Prevent default click event 1229 smoothScroll.animateScroll(toggle, toggle.hash, settings); // Animate scroll 1230 } 1231 }; 1232 1233 /** 1234 * On window scroll and resize, only run events at a rate of 15fps for better performance 1235 * @private 1236 * @param {Function} eventTimeout Timeout function 1237 * @param {Object} settings 1238 */ 1239 var eventThrottler = function (event) { 1240 if (!eventTimeout) { 1241 eventTimeout = setTimeout(function () { 1242 eventTimeout = null; // Reset timeout 1243 headerHeight = getHeaderHeight(fixedHeader); // Get the height of a fixed header if one exists 1244 }, 66); 1245 } 1246 }; 1247 1248 /** 1249 * Destroy the current initialization. 1250 * @public 1251 */ 1252 smoothScroll.destroy = function () { 1253 1254 // If plugin isn't already initialized, stop 1255 if (!settings) return; 1256 1257 // Remove event listeners 1258 root.document.removeEventListener('click', eventHandler, false); 1259 root.removeEventListener('resize', eventThrottler, false); 1260 1261 // Reset varaibles 1262 settings = null; 1263 eventTimeout = null; 1264 fixedHeader = null; 1265 headerHeight = null; 1266 }; 1267 1268 /** 1269 * Initialize Smooth Scroll 1270 * @public 1271 * @param {Object} options User settings 1272 */ 1273 smoothScroll.init = function (options) { 1274 1275 // feature test 1276 if (!supports) return; 1277 1278 // Destroy any existing initializations 1279 smoothScroll.destroy(); 1280 1281 // Selectors and variables 1282 settings = extend(defaults, options || {}); // Merge user options with defaults 1283 fixedHeader = root.document.querySelector(settings.selectorHeader); // Get the fixed header 1284 headerHeight = getHeaderHeight(fixedHeader); 1285 1286 // When a toggle is clicked, run the click handler 1287 root.document.addEventListener('click', eventHandler, false); 1288 if (fixedHeader) { root.addEventListener('resize', eventThrottler, false); } 1289 1290 }; 1291 1292 1293 // 1294 // Public APIs 1295 // 1296 1297 return smoothScroll; 1298 1299}); 1300 1301// end of smoothScroll -------------------------------------------------------------------------------------------------
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.