codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
// Slider Script var count = 0; var i = 1; var j = 0; var k = 0; var l = 0; var currentNum; var currentBloxSec; var currentSection; var currentClass; var currentClassName; var timeDelay = 5000; var featured = document.getElementById("featured"); var hovering = 0; var lastClass; var lastNum; var theShowCount; var featuredBusinessCount; var paused = 0; $('a.tab').removeClass('tabActive'); $('a.theShow.tab').addClass('tabActive'); currentClass = '.theShow1'; currentSection = '.theShow'; currentNum = 1; currentBloxSec = theShowCount; currentClassName = 'theShow'; lastClass = '.theShow1'; numBlox(); moveUpDown(); $('.theShow1').fadeIn("fast",function(){ var PlaySlide = setInterval("slider()", timeDelay); $('#skipd').click(function() { $('#pause').attr('src','images/play.png'); $('#pause').addClass('play'); paused = 1; clearInterval(PlaySlide); slider(); }) $('#pause').click(function() { if(paused == 0){ $('#pause').attr('src','images/play.png'); clearInterval(PlaySlide); paused = 1; }else if(paused == 1){ $('#pause').attr('src', 'images/pause.png'); PlaySlide = setInterval("slider()", timeDelay); paused = 0; } }) $('#back').click(function() { $('#pause').attr('src','images/play.png'); $('#pause').addClass('play'); paused = 1; clearInterval(PlaySlide); slideBack = 1; slider(); slideBack = 0; }) $('.numBox').click(function(){ var clicked = $(this).attr("class"); var tempor = new Array(); tempor = clicked.split(' ') lastClass = currentClass; currentClass = currentSection + tempor[1]; currentNum = tempor[1]; count = tempor[1]; var changing = lastClass; lastNum = changing.substring(changing.length - 1); if(currentSection == '.theShow'){ i = tempor[1]; }else if(currentSection == '.featuredBusiness'){ j = tempor[1]; } moveUpDown(); $(lastClass).fadeOut("slow",function(){ $(currentClass).fadeIn("slow") }); lastClass = currentClass; }) $('.tab').click(function(){ $('.tab').removeClass('tabActive'); $(this).addClass('tabActive'); var temp = $(this).attr('class'); var tmp = new Array(); tmp = temp.split(' '); lastClass = currentClass; currentSection = '.' + tmp[0]; if(currentSection == '.theShow'){ currentBloxSec = theShowCount; i = 1; j = 0; k = 0; l = 0; }else if(currentSection == '.featuredBusiness'){ currentBloxSec = featuredBusinessCount; i = theShowCount; j = 1; k = 0; l = 0; } currentNum = 1; numBlox(); $('.1').attr("id", "showing"); currentClass = currentSection + 1; $(lastClass).fadeOut("slow",function(){ $(currentClass).fadeIn("slow") }); lastClass = currentClass; }) }) //Move Displayed block up or down function moveUpDown(){ var b, moveUp, moveDown, shown; if(count == 0){ $('.1').attr("id", "showing"); } for(b=0; b <= currentBloxSec; b++){ if(b == currentNum){ moveUp = '.' + b; moveDown = '.' + (lastNum); $(moveUp).attr("id","showing"); $(moveDown).attr("id", " "); moveDown = moveUp; } } } function numBlox(){ var a, nextBlock; if(currentNum == 1){ $('.numBox').attr("id", ""); $('.numBox').hide(); for(a=1; a<=currentBloxSec; a++){ nextBlock = '.' + a; $(nextBlock).show(); } } } //Figure out which section we are currently on. function whichSection () { if(currentSection == '.theShow'){ currentNum = i; lastNum = i-1; currentBloxSec = theShowCount; currentClassName = 'theShow'; $('a.tab').removeClass('tabActive'); $('a.theShow.tab').addClass('tabActive'); } else if(currentSection == '.featuredBusiness'){ lastNum = j-1; currentNum = j; currentBloxSec = featuredBusinessCount; currentClassName = 'featuredBusiness'; $('a.tab').removeClass('tabActive'); $('a.featuredBusiness.tab').addClass('tabActive'); } } //This function will clear all of the links on featured menu of being active function clearAll(){ } //This function moves through each one of the divs. function slider(){ count++; if((i >= theShowCount) && (j >= featuredBusinessCount)){ i=0; j=0; k=0; l=0; } //Can possibly do If Else statement to pause the loop. I think that would be best. if(i < theShowCount){ i++; currentSection = '.theShow'; currentClass = currentSection + i; whichSection(); numBlox(); moveUpDown(); $(lastClass).fadeOut("slow",function(){ $(currentClass).fadeIn("slow") }); lastClass = currentClass; }else if(j < featuredBusinessCount){ j++; currentSection = '.featuredBusiness'; currentClass = currentSection + j; whichSection(); numBlox(); moveUpDown(); $(lastClass).fadeOut("slow",function(){ $(currentClass).fadeIn("slow") }); lastClass = currentClass; } }
Private
[
?
]
Run code
Submit