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