123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- (function ($) {
- /**
- * Get an HTMLElement using Jquery, and store them in a cache for a faster access later
- * @param selector {String} The Jquery selector to use
- * @return {(jQuery.fn.init | jQuery | HTMLElement)} The JQuery HTMLElement
- */
- $.selector_cache = function (selector) {
- if (!$.selector_cache[selector]) {
- $.selector_cache[selector] = $(selector);
- }
- return $.selector_cache[selector];
- };
- })(jQuery); // Edit JQuery namespace to use the function as $.selector_cache('#elements');
-
-
- $(document).ready(function () {
- loadHeader();
- fixheader();
- });
-
-
-
- $.selector_cache('.nav-item')
- .on('mouseover', function () {
- $(this).find('.link-effect').addClass('link-hovered');
- })
- .on('mouseleave', function () {
- $(this).find('.link-effect').removeClass('link-hovered');
- }).on('click', function () {
- $(this).find('.link-effect').removeClass('link-hovered');
- $(this).find('.link-effect').addClass('link-active');
- });
-
- /**
- * Stop the header from changing height on mobile (with fullscreen browsing)
- */
- function fixheader() {
- if ($.selector_cache("#headerJumbotron").length > 0) {
- let height = $(window).height() * 0.4;
- $.selector_cache('#headerJumbotron').css('height', height);
- }
- }
-
- function loadHeader() {
- if ($.selector_cache("#headerJumbotron").length > 0) {
- animateCss($.selector_cache('#headerTitle'), 'fadeInUp faster');
- $.selector_cache('#headerTitle').css('opacity', 1);
- setTimeout(function () {
- animateCss($.selector_cache('#headerSubTitle'), 'fadeInUp faster');
- $.selector_cache('#headerSubTitle').css('opacity', 1);
- }, 100);
-
- setTimeout(function () {
- $.selector_cache('#headerTop').addClass('loaded');
- }, 100);
-
- setTimeout(function () {
- $.selector_cache('#headerBottom').addClass('loaded');
- }, 300);
- }
- }
-
- // Using animate.css, translated into jquery
- // https://github.com/daneden/animate.css
- function animateCss($elem, animationName, callback) {
- $elem.addClass('animated ' + animationName);
- $elem.on('animationend', function () {
- $elem.removeClass('animated ' + animationName);
- if (typeof callback === 'function')
- callback();
- });
- }
|