CSS
-Tricks
treehouse :
what would you like to learn today?
Web Design
Web Development
iOS Development
Show search box
Search
Search in:
All
Articles
Forums
Snippets
Videos
✕
Home
Forums
Snippets
Gallery
Videos
Almanac
Demos
Lodge
Navigation 'n' Search
Forums
Illustration by Nick Sirotich
Forums
»
JavaScript Jungle
problem with jquery image slider
matthewb
Permalink to comment
#
March 2012
Hi warriors
I m new to jquery had just tried to make a horizontal image slider. Problem is clicking on 'next' btn should not work when on last slide, same with 'prev' button.
can any one help me out.
http://jsfiddle.net/matthew_b/6zrnW/1/
Melanie27
Permalink to comment
#
March 2012
You need to add a step to both your previous and next functions - for example:
$("#next").click( function(){
alert('hi');
$(current).animate({left: "-=1500px", top: "0px"}),
{
step: function(right) {
if (left <= 1500px) { //Slide width x number of slides<br />
$(current).stop(true, true);
}
}
});
Add a Comment
I m new to jquery had just tried to make a horizontal image slider. Problem is clicking on 'next' btn should not work when on last slide, same with 'prev' button.
can any one help me out.
http://jsfiddle.net/matthew_b/6zrnW/1/
$("#next").click( function(){
alert('hi');
$(current).animate({left: "-=1500px", top: "0px"}),
{
step: function(right) {
if (left <= 1500px) { //Slide width x number of slides<br />
$(current).stop(true, true);
}
}
});