Tip: Click lines to highlight, hold ctrl/cmd to multi-select
http://codedumper.com/evimo (2-Feb @ 01:08)
Syntax Highlighted Code
- ///////////////////////////////////////////////
- // autoscroll
- ///////////////////////////////////////////////
- // first hide the navigation buttons
- var $buttons = $('img.right').add('img.left').hide();
- // start to automatically cycle the tabs
- cycleTimer = setInterval(function () {
- $scroll.trigger('next');
- }, 5000); // how many milliseconds, change this to whatever you like
- // select some trigger elements to stop the auto-cycle
- var $stopTriggers = $('#slider .navigation').find('a') // tab headers
- .add('.scroll') // panel itself
- .add('.stopscroll') // links to the stop class div
- .add('.navigation') // links to navigation id for tabs
- .add("a[href^='#']"); // links to a tab
- // this is the function that will stop the auto-cycle
- function stopCycle() {
- // remove the no longer needed stop triggers
- clearInterval(cycleTimer); // stop the auto-cycle itself
- $buttons.show(); // show the navigation buttons
- document.getElementById('stopscroll').style.display='none'; // hide the stop div
- document.getElementById('startscroll').style.display='block'; // block the start div
- }
- // bind stop cycle function to the click event using namespaces
- $stopTriggers.bind('click.cycle', stopCycle);
- ///////////////////////////////////////////////
- // end autoscroll
- ///////////////////////////////////////////////
- // edit to start again
- ///////////////////////////////////////////////
- // select some trigger elements to stop the auto-cycle
- var $startTriggers_start = $('#slider .navigation').find('a') // tab headers
- .add('.startscroll'); // links to the start class div
- // this is the function that will stop the auto-cycle
- function startCycle() {
- // remove the no longer needed stop triggers
- $buttons.hide(); // show the navigation buttons
- $scroll.trigger('next'); // directly to the next first
- cycleTimer = setInterval(function () { // now set timer again
- $scroll.trigger('next');
- }, 5000); // how many milliseconds, change this to whatever you like
- document.getElementById('stopscroll').style.display='block'; // block the stop div
- document.getElementById('startscroll').style.display='none'; // hide the start div
- }
- // bind stop cycle function to the click event using namespaces
- $startTriggers_start.bind('click.cycle', startCycle);
- ///////////////////////////////////////////////
- // end edit to start
- ///////////////////////////////////////////////
Plain Code
///////////////////////////////////////////////
// autoscroll
///////////////////////////////////////////////
// first hide the navigation buttons
var $buttons = $('img.right').add('img.left').hide();
// start to automatically cycle the tabs
cycleTimer = setInterval(function () {
$scroll.trigger('next');
}, 5000); // how many milliseconds, change this to whatever you like
// select some trigger elements to stop the auto-cycle
var $stopTriggers = $('#slider .navigation').find('a') // tab headers
.add('.scroll') // panel itself
.add('.stopscroll') // links to the stop class div
.add('.navigation') // links to navigation id for tabs
.add("a[href^='#']"); // links to a tab
// this is the function that will stop the auto-cycle
function stopCycle() {
// remove the no longer needed stop triggers
clearInterval(cycleTimer); // stop the auto-cycle itself
$buttons.show(); // show the navigation buttons
document.getElementById('stopscroll').style.display='none'; // hide the stop div
document.getElementById('startscroll').style.display='block'; // block the start div
}
// bind stop cycle function to the click event using namespaces
$stopTriggers.bind('click.cycle', stopCycle);
///////////////////////////////////////////////
// end autoscroll
///////////////////////////////////////////////
// edit to start again
///////////////////////////////////////////////
// select some trigger elements to stop the auto-cycle
var $startTriggers_start = $('#slider .navigation').find('a') // tab headers
.add('.startscroll'); // links to the start class div
// this is the function that will stop the auto-cycle
function startCycle() {
// remove the no longer needed stop triggers
$buttons.hide(); // show the navigation buttons
$scroll.trigger('next'); // directly to the next first
cycleTimer = setInterval(function () { // now set timer again
$scroll.trigger('next');
}, 5000); // how many milliseconds, change this to whatever you like
document.getElementById('stopscroll').style.display='block'; // block the stop div
document.getElementById('startscroll').style.display='none'; // hide the start div
}
// bind stop cycle function to the click event using namespaces
$startTriggers_start.bind('click.cycle', startCycle);
///////////////////////////////////////////////
// end edit to start
///////////////////////////////////////////////