-
Notifications
You must be signed in to change notification settings - Fork 126
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
Open submenu on hover instead of click #13
Comments
+1 |
2 similar comments
+1 |
+1 |
+1 Any one find a solution? |
+1 |
1 similar comment
+1 |
Hi, my friends, I 've found a solution ! Just replace the function from line 67 to env. 110 by this one $.extend(SubmenuItem.prototype, Item.prototype, {
init: function() {
this.$element.on({
click: $.proxy(this, 'click'), // you can disable former click event here
keydown: $.proxy(this, 'keydown'),
mouseover: $.proxy(this, 'mouseover') //support for mouseover
});
this.$main.on('hide.bs.submenu, mouseleave', $.proxy(this, 'hide')); // added mouseleave for menu to reset when mouse leaves
},
click: function(event) { // you can disable former click event here
// Fix a[href="#"]. For community
/*event.preventDefault();
event.stopPropagation();
this.toggle();*/
},
mouseover: function(event) { // added mouseover function
this.open();
},
hide: function(event) {
// Stop event bubbling
event.stopPropagation();
this.close();
},
open: function() {
this.$main.addClass('open');
this.$subs.trigger('hide.bs.submenu');
},
toggle: function() {
if (this.$main.hasClass('open')) {
this.close();
}
else {
this.open();
}
},
keydown: function(event) {
// 13: Return, 32: Spacebar
if (event.keyCode == 32) {
// Off vertical scrolling
event.preventDefault();
}
if ($.inArray(event.keyCode, [13, 32]) != -1) {
this.toggle();
}
}
}); Also a big thanks to @vsn4ik for this very light and effective plug-in ! Hope this helps |
+1 |
+1 |
Thanks @myrmecia done that, here's my gist of the change: https://gist.github.com/macsplan/39c29d44ff5fd0b18d6699087f0a1874 Still opening on hover, any ideas where i'm going wrong? |
This is the modification to show the menu on mouseover I created for openQA some time ago: Martchus@2816257 We decided to stick with the on-click-version after all, but I tested it and it worked. |
thanks @Martchus do you have the code for the click-only version? |
The version in this repository is the click-only version. At least release v2.0.4 which we use in openQA. |
thanks @Martchus, must have a problem in my app. will figure it out, thanks |
How do I use bootstrap-submenu to open the submenu on hover? That's how bootstrap 2 did it: http://getbootstrap.com/2.3.2/components.html#dropdowns
The text was updated successfully, but these errors were encountered: