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:
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
Post a Comment