kinglozzer / SwipeMe

SwipeMe is a lightweight library for swiping open/close off-canvas menus
MIT License
43 stars 13 forks source link

Manual triggers don't work with multiple directions #2

Open feejin opened 11 years ago

feejin commented 11 years ago

Open left nav, click icon for right nav. Left nav now closes but right nav does not open.

Caused by this check:

// If the opposite side is already open, close it
    if (utils.hasClass(container, options.accessClasses[dir])) {
        utils.removeClass(container, options.accessClasses[dir]);
    } else if ( ! utils.hasClass(container, options.accessClasses[access]) && options.direction.indexOf(access) !== -1) {
    // If the side we're trying to expose isn't already open and if we're allowed to expose the panel
    utils.addClass(container, options.accessClasses[access]);
}

Removing the check means that swipes always open menus though. Perhaps an override on remotely triggered events?

kinglozzer commented 11 years ago

Perhaps we should have a separate function. That action is just for swiping: actions.swipe(), we could create a actions.openMenu() or similar for handling non-swipe events like menu triggers?