Solarpitch Posted September 1, 2011 Share Posted September 1, 2011 Hey, I have the following code that slides a div from left to right when you click on #Link. This works fine but when I click it again I want to slide it exactly the same from right to left. Problem with this is it just keeps sliding it right everytime I click the link. Tried using toggle but no matter what margin value I had specified, it slid the div right off the page. $(document).ready(function(){ $('#link').click(function() { $('.hidediv').animate({'marginRight' : "-=295px"}, 300); return false; }); }); Link to comment https://forums.phpfreaks.com/topic/246169-sliding-div-right-to-left/ Share on other sites More sharing options...
Adam Posted September 1, 2011 Share Posted September 1, 2011 I'm a little confused by why a toggle would animate it in the opposite direction? You need to literally include an animation that will take it the opposite direction. Link to comment https://forums.phpfreaks.com/topic/246169-sliding-div-right-to-left/#findComment-1264294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.