1jQuery(document).ready(function($) { 2 3 'use strict'; 4 5 6 /************** Toggle *********************/ 7 // Cache selectors 8 var lastId, 9 topMenu = $(".menu-first"), 10 topMenuHeight = 50, 11 // All list items 12 menuItems = topMenu.find("a"), 13 // Anchors corresponding to menu items 14 scrollItems = menuItems.map(function(){ 15 16 if($(this).hasClass('external')) { 17 return; 18 } 19 20 var item = $($(this).attr("href")); 21 if (item.length) { return item; } 22 }); 23 24 // Bind click handler to menu items 25 // so we can get a fancy scroll animation 26 menuItems.click(function(e){ 27 var href = $(this).attr("href"), 28 offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1; 29 $('html, body').stop().animate({ 30 scrollTop: offsetTop 31 }, 300); 32 e.preventDefault(); 33 }); 34 35 // Bind to scroll 36 $(window).scroll(function(){ 37 // Get container scroll position 38 var fromTop = $(this).scrollTop()+topMenuHeight; 39 40 // Get id of current scroll item 41 var cur = scrollItems.map(function(){ 42 if ($(this).offset().top < fromTop) 43 return this; 44 }); 45 // Get the id of the current element 46 cur = cur[cur.length-1]; 47 var id = cur && cur.length ? cur[0].id : ""; 48 49 if (lastId !== id) { 50 lastId = id; 51 // Set/remove active class 52 menuItems 53 .parent().removeClass("active") 54 .end().filter("[href=#"+id+"]").parent().addClass("active"); 55 } 56 }); 57 58 59 60 $(window).scroll(function(){ 61 $('.main-header').toggleClass('scrolled', $(this).scrollTop() > 1); 62 }); 63 64 65 66 $('a[href="#top"]').click(function(){ 67 $('html, body').animate({scrollTop: 0}, 'slow'); 68 return false; 69 }); 70 71 72 $('.flexslider').flexslider({ 73 slideshow: true, 74 slideshowSpeed: 3000, 75 animation: "fade", 76 directionNav: false, 77 }); 78 79 80 $('.toggle-menu').click(function(){ 81 $('.menu-first').toggleClass('show'); 82 // $('.menu-first').slideToggle(); 83 }); 84 85 $('.menu-first li a').click(function(){ 86 $('.menu-first').removeClass('show'); 87 }); 88 89 90 /************** LightBox *********************/ 91 $(function(){ 92 $('[data-rel="lightbox"]').lightbox(); 93 }); 94 95 96});
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.