I have this code with which I can hide/show. I want the div to hide while it moves left. How can I do that? This is what I have FIDDLE
$(document).ready(function() {
$("#button").toggle(function() {
$(this).text('Show Content');
}, function() {
$(this).text('Hide Content');
}).click(function(){
$("#hidden_content").slideToggle("slow");
});
});
<a href="#" id="button" class="button_style">Hide content</a>
<div id="hidden_content">Content</div>
You can do it this way:
$(document).ready(function() {
$("#button").toggle(function() {
$(this).text('Show Content');
$("#hidden_content").animate({left: "-50px"}, 500);
}, function() {
$(this).text('Hide Content');
$("#hidden_content").animate({left: "0px"}, 500);
})
});
Demo Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With