1(function ($) { 2 'use strict' 3 4 function removeNoJsClass () { 5 $('html:first').removeClass('no-js') 6 } 7 8 /* Sidr Menu --------------------- */ 9 function sidrMenu () { 10 $('#menu-toggle').sidr({ 11 name: 'side-menu', 12 side: 'right', // By default 13 source: '#navigation' 14 }) 15 var win = $(window).width() 16 $(window).on('resize', function () { 17 if (win <= 1025) { 18 if ($('body').hasClass('sidr-open') && !$('html').hasClass('no-js')) { 19 $.sidr('close', 'side-menu') 20 $('.icon-menu-close').hide() 21 $('.icon-menu-open').show() 22 } 23 } 24 }) 25 } 26 27 /* Mobile Submenu --------------------- */ 28 function subMenuSetup () { 29 if ($(window).width() <= 1025) { 30 // Toggle submenus 31 $('li.sidr-class-menu-item-has-children > a').after('<i class="fas fa-chevron-down"></i>') 32 $('li.sidr-class-menu-item-has-children i.fa-chevron-down').on('touchstart click', function () { 33 var submenu = $(this).parent().children('ul.sidr-class-sub-menu') 34 if ($(submenu).is(':hidden')) { 35 $(submenu).slideDown(200) 36 } else { 37 $(submenu).slideUp(200) 38 } 39 }) 40 } 41 } 42 43 /* Submenu Offset Fix --------------------- */ 44 function menuOffset () { 45 // Fix menu if off screen. 46 var mainWindowWidth = $(window).width() 47 48 $('#navigation ul.menu li.menu-item-has-children').mouseover(function () { 49 // Checks if second level menu exist. 50 var subMenuExist = $(this).find('.sub-menu').length 51 52 if (subMenuExist > 0) { 53 var subMenuWidth = $(this).find('.sub-menu').width() 54 var subMenuOffset = $(this).find('.sub-menu').parent().offset().left + subMenuWidth 55 56 // If sub menu is off screen, give new position. 57 if ((subMenuOffset + subMenuWidth) > mainWindowWidth) { 58 var newSubMenuPosition = subMenuWidth 59 $(this).find('ul.sub-menu').css({ 60 right: 0, 61 left: 'auto' 62 }) 63 } 64 if ((subMenuOffset + subMenuWidth + subMenuWidth) > mainWindowWidth) { 65 var newSubMenuPosition = subMenuWidth 66 $(this).find('ul.sub-menu ul.sub-menu').css({ 67 left: -newSubMenuPosition, 68 right: 'auto' 69 }) 70 } 71 } 72 }) 73 } 74 75 /* Flexslider --------------------- */ 76 function flexSliderSetup () { 77 if (($).flexslider) { 78 var slider = $('.flexslider') 79 slider.flexslider({ 80 slideshowSpeed: slider.attr('data-speed'), 81 animationDuration: 800, 82 animation: slider.attr('data-transition'), 83 video: false, 84 useCSS: false, 85 prevText: '<i class="fas fa-angle-left"></i>', 86 nextText: '<i class="fas fa-angle-right"></i>', 87 touch: false, 88 controlNav: false, 89 animationLoop: true, 90 smoothHeight: true, 91 pauseOnAction: true, 92 pauseOnHover: true, 93 94 start: function (slider) { 95 slider.removeClass('loading') 96 $('.preloader').hide() 97 setTimeout(function () { 98 $('.flexslider').resize() 99 }, 500) 100 } 101 }) 102 } 103 } 104 105 /* Portfolio Filter --------------------- */ 106 function isotopeSetup () { 107 var mycontainer = $('#portfolio-list') 108 mycontainer.isotope({ 109 itemSelector: '.portfolio-item' 110 }) 111 112 // filter items when filter link is clicked 113 $('#portfolio-filter a').click(function () { 114 var selector = $(this).attr('data-filter') 115 mycontainer.isotope({ filter: selector }) 116 return false 117 }) 118 } 119 120 /* Masonry --------------------- */ 121 function masonrySetup () { 122 var $container = $('.category-wrap').masonry() 123 $container.imagesLoaded(function () { 124 $container.masonry({ 125 itemSelector: '.single, .half, .third, .fourth' 126 }) 127 }) 128 } 129 130 function modifyPosts () { 131 var logoHeight = $('.adventure-has-logo.adventure-logo-no-overlay .custom-logo-link').outerHeight() 132 var legacyLogoHeight = $('.adventure-has-logo.adventure-logo-no-overlay #logo').outerHeight() 133 if ($('.adventure-has-logo.adventure-logo-no-overlay .custom-logo-link').length) { 134 $('.container').css('margin-top', logoHeight) 135 } 136 if ($('.adventure-has-logo.adventure-logo-no-overlay #logo').length) { 137 $('.container').css('margin-top', legacyLogoHeight) 138 } 139 140 /* Toggle Mobile Menu Icon --------------------- */ 141 $('.menu-toggle').on('click touchstart', function () { 142 $('.icon-menu-open').toggle() 143 $('.icon-menu-close').toggle() 144 }) 145 146 // Properly update the ARIA states on focus (keyboard) and mouse over events
147 $('[role="menubar"]').on('focus.aria mouseenter.aria', '[aria-haspopup="true"]', function (ev) { 148 $(ev.currentTarget).attr('aria-expanded', true) 149 }) 150 151 // Properly update the ARIA states on blur (keyboard) and mouse out events 152 $('[role="menubar"]').on('blur.aria mouseleave.aria', '[aria-haspopup="true"]', function (ev) { 153 $(ev.currentTarget).attr('aria-expanded', false) 154 }) 155 156 /* Hide Comments When No Comments Activated --------------------- */ 157 $('.nocomments').parent().css('display', 'none') 158 159 /* Animate Page Scroll --------------------- */ 160 $('.scroll').click(function (event) { 161 event.preventDefault() 162 $('html,body').animate({ scrollTop: $(this.hash).offset().top }, 500) 163 }) 164 165 /* Fit Vids --------------------- */ 166 $('.feature-vid, .article, .organic-widgets-card').fitVids() 167 } 168 169 $(document) 170 .ready(removeNoJsClass) 171 .ready(sidrMenu) 172 .ready(subMenuSetup) 173 .ready(menuOffset) 174 .ready(modifyPosts) 175 .on('post-load', modifyPosts) 176 177 $(window) 178 .on('load', flexSliderSetup) 179 .on('load', isotopeSetup) 180 .resize(masonrySetup) 181 .resize(isotopeSetup) 182 183 $(window).on('load', function () { 184 setTimeout(masonrySetup, 500) 185 }) 186})(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.