1$(function() { 2 // add a 'js' class to the body 3 $('body').addClass('js'); 4 5 // initialise the slideshow when the DOM is ready 6 $slideshow.init(); 7}); 8 9$slideshow = { 10 context: false, 11 tabs: false, 12 timeout: 10000, // time before next slide appears (in ms) 13 slideSpeed: 300, // time it takes to slide in each slide (in ms) 14 tabSpeed: 300, // time it takes to slide in each slide (in ms) when clicking through tabs 15 fx: 'scrollLeft', // the slide effect to use 16 17 init: function() { 18 // set the context to help speed up selectors/improve performance 19 this.context = $('#slideshow'); 20 21 // set tabs to current hard coded navigation items 22 this.tabs = $('ul.slides-nav li', this.context); 23 24 // remove hard coded navigation items from DOM 25 // because they aren't hooked up to jQuery cycle 26 this.tabs.remove(); 27 28 // prepare slideshow and jQuery cycle tabs 29 this.prepareSlideshow(); 30 }, 31 32 prepareSlideshow: function() { 33 // initialise the jquery cycle plugin - 34 // for information on the options set below go to: 35 // http://malsup.com/jquery/cycle/options.html 36 $("div.slides > ul", $slideshow.context).cycle({ 37 fx: $slideshow.fx, 38 timeout: $slideshow.timeout, 39 speed: $slideshow.slideSpeed, 40 fastOnEvent: $slideshow.tabSpeed, 41 pager: $("ul.slides-nav", $slideshow.context), 42 pagerAnchorBuilder: $slideshow.prepareTabs, 43 before: $slideshow.activateTab, 44 pauseOnPagerHover: true, 45 pause: true 46 }); 47 }, 48 49 prepareTabs: function(i, slide) { 50 // return markup from hardcoded tabs for use as jQuery cycle tabs 51 // (attaches necessary jQuery cycle events to tabs) 52 return $slideshow.tabs.eq(i); 53 }, 54 55 activateTab: function(currentSlide, nextSlide) { 56 // get the active tab 57 var activeTab = $('a[href="#' + nextSlide.id + '"]', $slideshow.context); 58 59 // if there is an active tab 60 if(activeTab.length) { 61 // remove active styling from all other tabs 62 $slideshow.tabs.removeClass('on'); 63 64 // add active styling to active button 65 activeTab.parent().addClass('on'); 66 } 67 } 68}; 69 70$(function() { 71 // initialise the slideshow when the DOM is ready 72 $slideshow.init(); 73});
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.