I am creating a website with a fixed menu on the left, the menu is visible on click with jQuery. My problem is that when I am scrolled down to the bottom of the page and I want to bring the menu into view the page jumps back to the top. I would like the page to stay in its current position when clicking on the menu. How can I do this?
This is the jQuery thats animates the menu in and out:
$(document).ready(function(){
$("#closeIcon").hide()
});
$(document).ready(function(){
$("#menuIcon").click(function(){
$(".left").animate({width:'10%'}, "500");
$(".right").animate({width:'90%'}, "500");
$("#nav").animate({
left: '30%',
}, "500" );
$("#menuIcon").fadeOut(500)
$("#closeIcon").fadeIn(500)
});
});
$(document).ready(function(){
$("#closeIcon").click(function(){
$(".left").animate({width:'0%'}, "500");
$(".right").animate({width:'100%'}, "500");
$("#nav").animate({
left: '0',
}, "500" );
$("#menuIcon").fadeIn(500)
$("#closeIcon").fadeOut(500)
});
});
The menu itself is positioned outside the page, on click it slides in and the main page resizes.