1var AFRIPOLAR_LODGES = AFRIPOLAR_LODGES || {}; 2 3(function (window, $, AFRIPOLAR_LODGES) { 4 5 /** 6 * Module for javascript sticky nav component 7 * 8 * @type {{initialize}} 9 */ 10 AFRIPOLAR_LODGES.stickynav = (function () { 11 12 var configuration = { 13 logoSelector: '.js__anchor-content__logo-wrp' 14 }, 15 $stickyContainer = {}; 16 17 /** 18 * Module initialization 19 */ 20 function initialize() { 21 $stickyContainer = jQuery('.js__sticky-content'); 22 23 if (!$stickyContainer.length || !window.matchMedia('(min-width: 992px)').matches) { 24 return false; 25 } 26 desktop(); 27 } 28 29 return { 30 initialize: initialize 31 }; 32 33 /** 34 * Handle sticky header for desktop viewport 35 */ 36 function desktop() { 37 var $stickyMenuContainer = jQuery('.js__sticky-content__menu-wrp'); 38 var topSpace; 39 var height; 40 41 if ($stickyContainer.hasClass('with-navigation')) { 42 topSpace = 62; 43 height = $stickyContainer.height() + 102; 44 } else { 45 topSpace = 0; 46 height = $stickyContainer.height() + 40; 47 } 48 49 $stickyContainer.sticky({ 50 topSpacing: topSpace, 51 zIndex: 1000 52 }) 53 .on('sticky-start', function () { 54 jQuery(this).find(configuration.logoSelector).removeClass('hidden').show(); 55 56 addStyles(); 57 toggleClasses($stickyMenuContainer, $stickyContainer); 58 }) 59 .on('sticky-end', function () { 60 jQuery(this).find(configuration.logoSelector).hide(); 61 62 removeStyles(); 63 toggleClasses($stickyMenuContainer, $stickyContainer); 64 }); 65 66 $stickyContainer.find('a').on('click', function (e) { 67 var $stickyWrapper = jQuery('.sticky-wrapper'); 68 69 if ($stickyWrapper.length) { 70 e.preventDefault(); 71 window.location = jQuery(this).attr('href'); 72 73 jQuery('html, body').animate({ 74 scrollTop: jQuery(window.location.hash).offset().top - height 75 }, 0); 76 return false; 77 } 78 else { 79 return true; 80 } 81 }) 82 } 83 84 /** 85 * Toggles grid column and sticky classes 86 * 87 * @param $stickyMenuContainer 88 */ 89 function toggleClasses($stickyMenuContainer) { 90 $stickyMenuContainer.toggleClass('col-lg-12'); 91 $stickyMenuContainer.toggleClass('col-md-12'); 92 93 $stickyMenuContainer.toggleClass('col-lg-9'); 94 $stickyMenuContainer.toggleClass('col-md-9'); 95 } 96 97 /** 98 * Add styles 99 */ 100 function addStyles() { 101 $stickyContainer.css('width', '100%'); 102 } 103 104 /** 105 * Remove styles 106 */ 107 function removeStyles() { 108 } 109 })(); 110 111})(window, jQuery, AFRIPOLAR_LODGES);
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.