Reputation: 1277
I have a jQuery slider in working motion with previous and next buttons. The only thing is,I want it so that when you hover on these buttons, a preview of the next or previous slide is shown and when you move your mouse away they hide. I just can't seem to get it to work...
$('.next_slide').mouseenter(function() {
$('.slide_container li').stop().animate({ left: -440 }, 10, 'easeInOutExpo');
});
my html is....
<div id="slides">
<ul class="slide_container">
<li class="one slide"></li>
<li class="two slide"></li>
<li class="three slide"></li>
</ul>
<div id="slide_nav">
<a href="#" class="prev_slide">« Previous</a>
<a href="#" class="next_slide">Next »</a>
</div>
</div>
The slides are 1440px in width.
Upvotes: 0
Views: 192
Reputation: 4517
You only have mouseenter, not mouseout; you should defined both.
If you use Hover, you can include both actions in the same script.
For example (from the jQuery site):
$("li").hover(
function () {
$(this).append($("<span> ***</span>"));
},
function () {
$(this).find("span:last").remove();
}
);
Upvotes: 0
Reputation: 4972
Try this -
$('.next_slide').hover(
function(){ // OVER
$('.slide_container li').stop().animate({ left: -440 }, 10, 'easeInOutExpo');
},
function(){ // OUT
$('.slide_container li').stop().animate({ left: 0 }, 10, 'easeInOutExpo');
}
);
Upvotes: 1