javascript - emberjs menu component bubbling -


i have menu component, build tree menu array. toggle sub menus do:

  didinsertelement:function(){     this.$('li.sub').click(function(e){       $('ul', this).slidetoggle();     });   } 

i works fine long click on 'settings'. if try click 1 of sub menus ex. 'currency' closes parent menu item.

here jsbin demonstrate problem: click on 'settings' -> click 1 of opened sub items:

http://emberjs.jsbin.com/bexivuhohu/6/edit

the reason parent component still handling click - when clicking on child component.

i recommend moving click handling component, rather jquery - , returning false. if child component returns false parent component doesn't double handle click.

click: function() {   this.$('ul').slidetoggle();   return false; } 

see working jsbin: http://emberjs.jsbin.com/bibeho/1/edit?html,js,output


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -