Skip to content
This repository has been archived by the owner on Feb 18, 2020. It is now read-only.

jPanelMenu not working properly in IE (all versions) #79

Open
VisiaMedia opened this issue May 22, 2014 · 1 comment
Open

jPanelMenu not working properly in IE (all versions) #79

VisiaMedia opened this issue May 22, 2014 · 1 comment

Comments

@VisiaMedia
Copy link

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.

<script> $(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); }); </script> <script> $(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'); }); }); </script>

Thanks in advance for helping me out!

@VisiaMedia
Copy link
Author

$(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');
});

});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant