Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offcanvas without triggerButton #40

Closed
n3t opened this issue Feb 27, 2019 · 4 comments
Closed

Offcanvas without triggerButton #40

n3t opened this issue Feb 27, 2019 · 4 comments

Comments

@n3t
Copy link

n3t commented Feb 27, 2019

Hi,

when creating offcanvas without triggerButton specified, an error 'Element required to initialize object' is raised.

    jQuery(function($) {
      $('#offcanvas').offcanvas({
        modifiers: 'left,overlay',
      });
    });

I use this code, as offcanvas in my case is not triggered by any alement, but appears as feedback to AJAX action (after user add something to cart).

I can bypass this issue by creating invisible element like this

    jQuery(function($) {
      $('#offcanvas').offcanvas({
        modifiers: 'left,overlay',
        triggerButton: jQuery('<span/>')
      });
    });

Is this expected behavior, or an issue? Would be nice to have option to omit triggerButton, when not needed.

thanks

Pavel

@vmitsaras
Copy link
Owner

Hi Pavel,
thanks for that.
I already thought of that, but unfortunately the triggerButton is required.
I'll check it out and get back.

Did you try to use the Cart-Button as triggerButton instead?

@n3t
Copy link
Author

n3t commented Feb 27, 2019

Hi,

the point is, that there is no Cart button opening offcanvas. The cart button redirects user to cart already, offcanvas is displayed just after he adds something to cart from AJAX event only. So no control to display offcanvas manually by user...

Pavel

vmitsaras pushed a commit that referenced this issue Mar 6, 2019
@vmitsaras
Copy link
Owner

Hi Pavel,

can you test it if this works and let me know
https://github.com/vmitsaras/js-offcanvas/blob/40-offcanvas-without-triggerbutton/dist/_js/js-offcanvas.pkgd.js
Thanks

@n3t
Copy link
Author

n3t commented Mar 22, 2019

Hi,

sorry for late reply, I was quite busy last few days.
Yes, this works like a charm, thank you very much.

Pavel

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

No branches or pull requests

2 participants