I am attempting to implement a slideout function from the right side using jQuery. I have tried modifying the code for "From Left to Right" but it doesn't seem to be working correctly. Can you please provide me with guidance on how to make the necessary modifications?
Here is the code I am currently using:
$(function() {
$('#nav').stop().animate({'marginRight':'-100px'},1000);
function toggleDivs() {
var $inner = $("#nav");
if ($inner.position().right == "-100px") {
$inner.animate({right: 0});
$(".nav-btn").html('<img src="images/slide-out.png" alt="open" />')
}
else {
$inner.animate({right: "100px"});
$(".nav-btn").html('<img src="images/slide-out.png" alt="close" />')
}
}
$(".nav-btn").bind("click", function(){
toggleDivs();
});
});