編集
はそれはとても
:-)このコードを使用する前に、私はそれとカスタムウィジェットを作成することができたことをご検討ください、これはとにかく悪いユーザー体験を提供してい判明しましたこのような機能:
jQuery.widget("custom.hoverSelectmenu", jQuery.ui.selectmenu, {
_create: function() {
this._super();
var that = this;
this._on(this.button, {
mouseenter: function(event) {
that.open();
},
mouseleave: function(event) {
if (event.toElement != that.menu.get(0)) {
that.close();
}
}
});
this._on(this.menu, {
mouseleave: function(event) {
if (event.toElement != that.button.get(0)) {
that.close();
}
}
});
}
});
jQuery('.selectbox').hoverSelectmenu({
});
更新
のFirefox、ChromeとIE 11で、次の作品は(下IEがテストされていません)
_leaveWidget: function(event) {
var target = event.toElement || event.relatedTarget || event.target;
if (!(
jQuery.contains(this.button.get(0), target) ||
jQuery(this.button.get(0)).is(target) ||
jQuery.contains(this.menu.get(0), target) ||
jQuery(this.menu.get(0)).is(target)
)) {
this.close();
}
},
_create: function() {
this._super();
var that = this;
this._on(this.button, {
mouseenter: function (event) {
that.open();
},
mouseout: that._leaveWidget
});
this._on(this.menu, {
mouseout: that._leaveWidget
});
},
は、代わりに '' .hover() 'の' .on( 'のMouseEnter')を使用してください。 'hover()'はマウス出力機能を追加します –