ascott1/bigSlide.js

easyClose doesn't work if menu option is set to something other than 'menu'

Opened this issue · 8 comments

If the menu option is changed to something other than the default 'menu', say $('#sidenav'), the panel doesn't close even when easyClose is set to true. The following error is also referenced in FF's console: ReferenceError: menu is not defined.

Not sure if this is a bug or something I'm doing.

@beau-gosse when initiating the plugin are you changing the menu option? Such as:

$( '#sidenav').bigSlide({
    menu: "#sidenav"
});

@ascott1 I tried the following two methods and both produced the results I described:

Method 1:

// .sidenav-trigger being the button used to open the sidenav
$('.sidenav-trigger').bigSlide({
    menu: '#sidenav',
    easyClose: true,
});

Method 2 (as you suggested):

$('#sidenav').bigSlide({
    menu: '#sidenav',
    easyClose: true,
});

Thanks for the prompt follow-up!

Sorry for the problems @beau-gosse! I'll start looking into it, but it may take a bit before I get there.

Hey, I just had to fix this for a client this morning, here's what I did- not sure if it's the 'right' answer but:

Line 157:
if (!$(e.target).parents().andSelf().is(menuLink) && !$(e.target).closest(menu).length && controller.getState() === 'open') {

Change to:
if (!$(e.target).parents().andSelf().is(menuLink) && !$(e.target).closest(settings.menu).length && controller.getState() === 'open') {

The variable 'menu' is not defined in this context, I assumed it should be the menu stored in the init settings, and it appears to work after making this change.

Nice catch @jblatt! I'd welcome a pull request, or I can make this update soon.

Hah, I'm just learning git on the command line but I'll give it shot!

Hah, I'm just learning git on the command line but I'll give it shot!

Yay! Hooray for open source!

Hi,

This mobile Safari fix didn't work for me unfortunately, just wondering if there has been any new updates since Oct 22?