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

Close button on menu? #55

Open
rubaff opened this issue Sep 14, 2015 · 7 comments
Open

Close button on menu? #55

rubaff opened this issue Sep 14, 2015 · 7 comments

Comments

@rubaff
Copy link

rubaff commented Sep 14, 2015

Thanks for the great plugin. I use it a lot!

Is there a native function for a "close"-button on the menu or do I need to fake the click via jquery and easyclose?

Thanks!

@ascott1
Copy link
Owner

ascott1 commented Sep 14, 2015

Thanks @rubaff. Is the changeState function what you were hoping for?

@rubaff
Copy link
Author

rubaff commented Sep 23, 2015

Thanks for the response @ascott1. How can I use the function with a click? If changeState is changed the menu closes? Do you have a code snippet at hand? Thanks again!

@soodaa
Copy link

soodaa commented Sep 25, 2015

Same question ^^^
Thanks

@ascott1
Copy link
Owner

ascott1 commented Sep 25, 2015

This isn't the most elegant way to do things (particularly since we have to manually assign this.$menu and $this.push, but this would initiate the plugin and toggle the menu closed any time a user clicks an <h1>:

$(document).ready(function() {
  $('.menu-link').bigSlide();
    this.$menu = $('#menu');
    this.$push = $('.push');
    var bigSlideAPI = ($('.menu-link').bigSlide()).bigSlideAPI;
    $('h1').click(function() {
      bigSlideAPI.view.toggleClose();
    });
 });

One catch is that if you're simulating something like easyClose be sure that the link that toggles the menu open/closed is not a child of the dom element you are using to override the default click behavior. That could have some funky results.

I hope that's useful!

@soodaa
Copy link

soodaa commented Sep 26, 2015

HI Adam,

Thanks a lot for this solution, i’ll give it a try.

Marnix

Op 25 sep. 2015, om 15:14 heeft Adam Scott [email protected] het volgende geschreven:

This isn't the most elegant way to do things (particularly since we have to manually assign this.$menu and $this.push, but this would initiate the plugin and toggle the menu closed any time a user clicks an

:

$(document).ready(function
() {
$(
'.menu-link'
).bigSlide();

this.$menu = $('#menu'
);

this.$push = $('.push'
);

var bigSlideAPI = ($('.menu-link'
).bigSlide()).bigSlideAPI;
$(
'h1').click(function
() {
bigSlideAPI.view.toggleClose();
});
});

One catch is that if you're simulating something like easyClose be sure that the link that toggles the menu open/closed is not a child of the dom element you are using to override the default click behavior. That could have some funky results.

I hope that's useful!


Reply to this email directly or view it on GitHub.

@rubaff
Copy link
Author

rubaff commented Oct 22, 2015

Thanks @ascott1!

I'm using it like this now - working perfectly fine!

  $(document).ready(function () {
        var bigSlideAPI = ($('.menu-link').bigSlide({
            side: 'right',
            menuWidth: "320px"
        })).bigSlideAPI;
        $('.menu-close').click(function() {
          bigSlideAPI.view.toggleClose();
        });
   });

@ascott1
Copy link
Owner

ascott1 commented Oct 22, 2015

Great!

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

No branches or pull requests

3 participants