Open VisiaMedia opened 10 years ago
$(document).on('touchend',jP.panel,function(e){ e.preventDefault(); if ( jP.menuIsOpen() ) jP.closeMenu(jP.options.animated); });
$(document).on('click',jP.panel,function(e){ e.preventDefault(); if ( jP.menuIsOpen() ) jP.closeMenu(jP.options.animated); });
$(document).ready(function(){ var jPM = $.jPanelMenu({ closeOnContentClick: false }); jPM.on();
$('a[href^="#"]').on('click',function (e) { e.preventDefault();
var target = this.hash, $target = $(target);
$('html, body').stop().animate({ 'scrollTop': $target.offset().top-50 }, 900, 'swing', function () { window.location.hash = target; }); setTimeout(function() { jPM.close(true); }, 900, 'swing'); });
});
I'm using the jPanelMenu jQuery plugin on one of my websites, I'm also using smoothscrolling with jQuery. I noticed a problem in IE (all versions).
When the menu is triggered, it slides in as it's supposed to. After clicking a menu item, the page scrolls to the desired section and closes again. As the menu closes, the right side of the website gets an unwanted margin. When opening the menu again, it's half it's size and closes the gap of the content again.
Here's the code I'm using for the menu and smooth scroll.
Thanks in advance for helping me out!