artberri / sidr

Sidr is a jQuery plugin for creating side menus and the easiest way for doing your menu responsive.
http://www.berriart.com/sidr/
MIT License
2.89k stars 597 forks source link

When I click to open "sidr side menu" I´m also clicking on my sidr menu item #165

Closed oscar5 closed 8 years ago

oscar5 commented 10 years ago

I followed the sidr documentation here: http://www.berriart.com/sidr/.

And I already have my sidr side left menu working fine.

But on my mobile,only on android default browser, when I click in my link "Open Menu" I also click on my menu item "Menu 1", and so it opens my submenu items with my toggle effect. And I dont want this.

I just want to open my submenu items when I click in my Menu items, and not in my link to open the menu.

I found a solution, that is, if I put my sidr menu with some margin top, to not align with my link to open the menu, the problem is solved, like in my second image.

But I dont want to give that margin-top, so Im trying look for other solution.

Somebody there have exprience with this plugin and can give me a help??

If my link to open the sidr menu is aligned with my menu Item, Im clicking on both when I click to open the menu!

If my link to open the menu is not aligned with menu 1... I only click on my link and it works fine!

This is my jQuery to start sidr plugin:

 $(document).ready(function() {
      $('#simple-menu').sidr({
           name: 'sidr', 
          speed: 200, 
          side: 'left',
          source: null, 
          renaming: true, 
          body: 'body'

         });
    });        
$(document).ready(function() {
    $('.sub-menu-sidr').hide();
    });
});
dented commented 10 years ago

Add this line after line 304 which is the e.preventDefault(); inside the only click event.

e.stopPropagation(); // add this

MrMooky commented 10 years ago

We're having the same issue. Unfortunately, this "fix" doesn't work.

biyanpasau commented 10 years ago

Same here. Hopefully someone finds a fix for this soon.

englishextra commented 10 years ago

I came accross this and found out that this happanes on smartphones. Not tablets.

What you could do right now is to: 1) remove position relative from body element if t is there 2) move sidr block with lists away from div.container or whatever it is in your case

simube commented 10 years ago

Same problem here! I'd like to position the menu button and the menu on the right side, but when sidr opens, it always selects the first or second menu item depending on the touch position! I think, that android handles the touchstart/touchend events different than iOS or other devices. please fix this issue.

englishextra commented 10 years ago

this issue has been discussed but arbery stays silent

remon commented 10 years ago

I used these plugin and everything is good now and problem solved with me

https://github.com/ftlabs/fastclick

henev commented 9 years ago

You can check my solution of this problem right here : http://stackoverflow.com/questions/23586209/when-i-click-to-open-sidr-side-menu-i%C2%B4m-also-clicking-on-my-sidr-menu-item/26970340#26970340

simube commented 9 years ago

hmm, this still does not work on my websites. see www.konkreet.ch

sideMenuLinks.on('click', function(e) {

could it be, that there is no "click" event fired, but a "touch", "touchend" or something? I don't have an android device to test...

henev commented 9 years ago

How it doesn't work when you have no android to test on ?

simube commented 9 years ago

i tested on a device of a friend... ;) sorry!

henev commented 9 years ago

Does it go into the on click callback function? Try debugging it. Check if you are binding this to the right elements. Make sure you change your plugin code.

Kris0 commented 9 years ago

Thank you remon. FastClick fixed the problem for me, too.

artberri commented 8 years ago

Preparing a new version with a fix for this https://github.com/artberri/sidr/tree/reborn