The idea is to click Slide Left and the DIV’s slide left – that works. What doesn’t work is if I click Slide Right and nothing moves.
Any help is appreciated.
$(function(){
$(".link1").click(function(){
$(".block1").stop(true, true).animate({left:-400}, 200);
$(".block2").stop(true, true).animate({left:25}, 200);
});
});
$(function(){
$(".link2").Click(function(){
$(".block2").stop(true, true).animate({left:450}, 200);
$(".block1").stop(true, true).animate({left:25}, 200);
});
});
and HTML
<div id="block_container">
<div class="block1">
<div class="link1">Slide Left</div>
</div>
<div class="block2">
<div class="link2">Slide Right</div>
</div>
</div>
Typo, you have an uppercase ‘C’ for the
clickfunction on the.link2selector.It’s also worth noting that you don’t need to wrap each handler in it’s own document ready handler.
Updated fiddle