bigSlide.js icon indicating copy to clipboard operation
bigSlide.js copied to clipboard

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

Open beau-gosse opened this issue 9 years ago • 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 avatar Sep 19 '15 04:09 beau-gosse

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

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

ascott1 avatar Sep 20 '15 11:09 ascott1

@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!

beau-gosse avatar Sep 20 '15 17:09 beau-gosse

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

ascott1 avatar Sep 21 '15 13:09 ascott1

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.

jlblatt avatar Oct 21 '15 15:10 jlblatt

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

ascott1 avatar Oct 21 '15 18:10 ascott1

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

jlblatt avatar Oct 22 '15 01:10 jlblatt

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

Yay! Hooray for open source!

ascott1 avatar Oct 22 '15 12:10 ascott1

Hi,

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

digitalgypsy avatar May 28 '16 14:05 digitalgypsy