I need the code to make the function that I already have work both ways:
$(document).ready(function() {
$('#scroll').click(function() {
$('#scroll').animate({left: '2%'});
$('.leftslide').animate({left: '-84%'});
$('.rightslide').animate({left: '9%'});
$('#scroll').animate({rotate: '180' });
});
});
So, what I have is explained on the image below. The .rightslide
moves to the position of .leftslide
, leaving .leftslide partially visible. Now, everything works fine, but I need the #scroll
to move the .rightslide
back to it's initial position when it's clicked for the second time (when .rightslide
is at 9% already).
I hope everything is understandable. If not, imagine, if you will, a button that opens the door, and once it is open, the same button can be pressed to close it.