var $j = jQuery;
$j(document).ready(function() {
//
// extend the core jQuery with disableSelection
jQuery.fn.extend({
disableSelection : function() {
this.each(function() {
this.onselectstart = function() {
return false;
};
this.unselectable = "on";
jQuery(this).css('-moz-user-select', 'none');
});
}
});
//
// disable selection of grade by grade
$j('#carousel').disableSelection();
// initialize state
$j('#banner').animate({"opacity" : .9}, 0);
$j('#info h2, #info p, #image img,#buttons li,#next,#prev').hide();
var MINI = 1; // at least one slide must be set in the carousel
var MAXI = 8; // no more than 8 slides can be set in the carousel
var i = 1;
var images = $j('#image img');
var SETI = (images ? images.size() : 0);
var fadeTime = 2000;
var holdTime = 4000;
var swapTime = 2000;
var holdID = null;
var swapID = null;
if (SETI > MAXI) {
SETI = MAXI;
}
if (SETI < MINI) {
SETI = MINI;
}
// Run animation
// Initially, image 1 fadeIn over 2 secs
// image 1 holds for 4 secs
var fadeInSlide = function() {
$j('#image img:eq(' + (i - 1) + ')').fadeIn(fadeTime);
holdID = setTimeout(fadeOutSlide, holdTime);
}
// image 1 fadeOut over 2 secs
// blank holds for 2 secs
var fadeOutSlide = function() {
clearTimeout(holdID);
$j('#image img:eq(' + (i - 1) + ')').fadeOut(fadeTime);
swapID = setTimeout(nextSlide, swapTime);
}
// text 1 hides
// nav goes to 2
// text 2 shows
var nextSlide = function() {
clearTimeout(swapID);
if (i >= SETI) {
i = MINI;
} else {
i++;
}
setText(i);
setButtonState(i);
fadeInSlide();
}
// image 2 fadeIn over 2 secs
// Stop...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.