TIGblogs TIG | TIGblogs GROUP TIGBLOGS LOGIN SIGNUP
betzster's Blog
betzster's Blog
Anything Slider: Go on “Go”

Last week when I was in the CSS-Tricks forums, somebody wanted to modify the functionality of Chris Coyier’s anythingSlider. Not a huge change, he just wanted to make the slider advance to the next panel when you click “Go”. Made sense to me. By the time you click “Go”, you’re done looking at that panel and are ready for the next one. If it doesn’t advance until after whatever delay you’ve setup, it could be confusing.

Basically what we want to do is make the slider advance to the next panel when we click go, which is the same as advancing to the next panel after we click the start/stop button if the slider ends up playing. It sounds complicated, but it will make more sense when we look at the code.

base.$startStop.click(function(e){ base.startStop(!base.playing); if(base.playing) base.goForward(true); e.preventDefault(); });

What I’ve done is find the place where he sets up the Start/Stop button that I mentioned above. Since he’s already go something going on if the button is clicked I used that to add our line that says to advance one panel. It took me a second to figure out that we wanted to slider to be playing instead of paused. The reason for this is that we’re inside the click function, which means we’ve already clicked the start/stop button. This probably seems pretty obvious to most people, but I was coming at this from a different perspective I guess.

Anyway, this is what I’m using on this site now. I really like the functionality so far. It’s nice to see the slider actually advance when you click go instead of staying on the same slide for another couple of seconds.


February 9, 2010 | 8:02 AM Comments  0 comments

Tags:
You must be logged in to add tags.


Josh's Profile


Latest Posts
Network Favicons
Set up VirtualBox for...
Facebook Hackathon...
On Comments
WordPress &...

Monthly Archive
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
March 2008
April 2008
May 2008
June 2008
July 2008
September 2008
October 2008
November 2008
December 2008
January 2009
February 2009
March 2009
April 2009
May 2009
June 2009
July 2009
August 2009
September 2009
October 2009
November 2009
December 2009
January 2010
February 2010
March 2010
April 2010
June 2010
July 2010
August 2010
September 2010
October 2010
November 2010
December 2010
January 2011
February 2011
March 2011
April 2011
June 2011
September 2011
October 2011
November 2011
December 2011
January 2012

Change Language


Tags Archive
apache apple asides band blog blogs coding design dreamweaver florida gallery general globalwarming hosting internet johnmayer network nifty php plugins school service tech theme themes twitter vacation web wordpress youtube

Links
High School Reunion
Josh Betz Blog
Josh Betz Professional
Josh Betz Projects


27737 views
Important Disclaimer