I want to make a slider. I have two divs, left arrow and right arrow.
My idea is that when the left or the right arrow is clicked, the div that is active is hidden and the other view is displayed.
I am doing this with toggle(), and it hides the first view, but it doesn't show the second view.
And it needs to go smoothly, like a carousel.
Here is my JQuery:
$("#test2").hide();
$("#left").click(function(){
$("#test1").toggle("slide", function(){
$("#test1").show();
$("#test2").hide();
}, function(){
$("#test2").show();
$("#test1").hide();
});
});
Here is an example of the HTML:
<div class="row">
<div id="left></div>
<div id="test1">image + text</div>
<div id="test2">image + text</div>
<div id="right"></div>
</div>
show()andhide(). What do you expect as a result except nothing? Ever heard about "double negation" ?