1/** 2* Template Name: Bootslander - v2.3.0 3* Template URL: https://bootstrapmade.com/bootslander-free-bootstrap-landing-page-template/ 4* Author: BootstrapMade.com 5* License: https://bootstrapmade.com/license/ 6*/ 7!(function($) { 8 "use strict"; 9 10 // Preloader 11 $(window).on('load', function() { 12 if ($('#preloader').length) { 13 $('#preloader').delay(100).fadeOut('slow', function() { 14 $(this).remove(); 15 }); 16 } 17 }); 18 19 // Smooth scroll for the navigation menu and links with .scrollto classes 20 var scrolltoOffset = $('#header').outerHeight() - 21; 21 $(document).on('click', '.nav-menu a, .mobile-nav a, .scrollto', function(e) { 22 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 23 var target = $(this.hash); 24 if (target.length) { 25 e.preventDefault(); 26 27 var scrollto = target.offset().top - scrolltoOffset; 28 29 if ($(this).attr("href") == '#header') { 30 scrollto = 0; 31 } 32 33 $('html, body').animate({ 34 scrollTop: scrollto 35 }, 1500, 'easeInOutExpo'); 36 37 if ($(this).parents('.nav-menu, .mobile-nav').length) { 38 $('.nav-menu .active, .mobile-nav .active').removeClass('active'); 39 $(this).closest('li').addClass('active'); 40 } 41 42 if ($('body').hasClass('mobile-nav-active')) { 43 $('body').removeClass('mobile-nav-active'); 44 $('.mobile-nav-toggle i').toggleClass('icofont-navigation-menu icofont-close'); 45 $('.mobile-nav-overly').fadeOut(); 46 } 47 return false; 48 } 49 } 50 }); 51 52 // Activate smooth scroll on page load with hash links in the url 53 $(document).ready(function() { 54 if (window.location.hash) { 55 var initial_nav = window.location.hash; 56 if ($(initial_nav).length) { 57 var scrollto = $(initial_nav).offset().top - scrolltoOffset; 58 $('html, body').animate({ 59 scrollTop: scrollto 60 }, 1500, 'easeInOutExpo'); 61 } 62 } 63 }); 64 65 // Mobile Navigation 66 if ($('.nav-menu').length) { 67 var $mobile_nav = $('.nav-menu').clone().prop({ 68 class: 'mobile-nav d-lg-none' 69 }); 70 $('body').append($mobile_nav); 71 $('body').prepend('<button type="button" class="mobile-nav-toggle d-lg-none"><i class="icofont-navigation-menu"></i></button>'); 72 $('body').append('<div class="mobile-nav-overly"></div>'); 73 74 $(document).on('click', '.mobile-nav-toggle', function(e) { 75 $('body').toggleClass('mobile-nav-active'); 76 $('.mobile-nav-toggle i').toggleClass('icofont-navigation-menu icofont-close'); 77 $('.mobile-nav-overly').toggle(); 78 }); 79 80 $(document).on('click', '.mobile-nav .drop-down > a', function(e) { 81 e.preventDefault(); 82 $(this).next().slideToggle(300); 83 $(this).parent().toggleClass('active'); 84 }); 85 86 $(document).click(function(e) { 87 var container = $(".mobile-nav, .mobile-nav-toggle"); 88 if (!container.is(e.target) && container.has(e.target).length === 0) { 89 if ($('body').hasClass('mobile-nav-active')) { 90 $('body').removeClass('mobile-nav-active'); 91 $('.mobile-nav-toggle i').toggleClass('icofont-navigation-menu icofont-close'); 92 $('.mobile-nav-overly').fadeOut(); 93 } 94 } 95 }); 96 } else if ($(".mobile-nav, .mobile-nav-toggle").length) { 97 $(".mobile-nav, .mobile-nav-toggle").hide(); 98 } 99 100 // Navigation active state on scroll 101 var nav_sections = $('section'); 102 var main_nav = $('.nav-menu, .mobile-nav'); 103 104 $(window).on('scroll', function() { 105 var cur_pos = $(this).scrollTop() + 200; 106 107 nav_sections.each(function() { 108 var top = $(this).offset().top, 109 bottom = top + $(this).outerHeight(); 110 111 if (cur_pos >= top && cur_pos <= bottom) { 112 if (cur_pos <= bottom) { 113 main_nav.find('li').removeClass('active'); 114 } 115 main_nav.find('a[href="#' + $(this).attr('id') + '"]').parent('li').addClass('active'); 116 } 117 if (cur_pos < 300) { 118 $(".nav-menu ul:first li:first, .mobile-menu ul:first li:first").addClass('active'); 119 } 120 });
121 }); 122 123 // Toggle .header-scrolled class to #header when page is scrolled 124 $(window).scroll(function() { 125 if ($(this).scrollTop() > 100) { 126 $('#header').addClass('header-scrolled'); 127 } else { 128 $('#header').removeClass('header-scrolled'); 129 } 130 }); 131 132 if ($(window).scrollTop() > 100) { 133 $('#header').addClass('header-scrolled'); 134 } 135 136 // Back to top button 137 $(window).scroll(function() { 138 if ($(this).scrollTop() > 100) { 139 $('.back-to-top').fadeIn('slow'); 140 } else { 141 $('.back-to-top').fadeOut('slow'); 142 } 143 }); 144 145 $('.back-to-top').click(function() { 146 $('html, body').animate({ 147 scrollTop: 0 148 }, 1500, 'easeInOutExpo'); 149 return false; 150 }); 151 152 // Initiate the venobox plugin 153 $(window).on('load', function() { 154 $('.venobox').venobox(); 155 }); 156 157 // jQuery counterUp 158 $('[data-toggle="counter-up"]').counterUp({ 159 delay: 10, 160 time: 1000 161 }); 162 163 // Initiate venobox lightbox 164 $(document).ready(function() { 165 $('.venobox').venobox(); 166 }); 167 168 // Testimonials carousel (uses the Owl Carousel library) 169 $(".testimonials-carousel").owlCarousel({ 170 autoplay: true, 171 dots: true, 172 loop: true, 173 items: 1 174 }); 175 176 // Init AOS 177 function aos_init() { 178 AOS.init({ 179 duration: 1000, 180 easing: "ease-in-out", 181 once: true, 182 mirror: false 183 }); 184 } 185 $(window).on('load', function() { 186 aos_init(); 187 }); 188 189})(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.