jquery ui selectmenu滚动条不起作用 [英] jquery ui selectmenu scrollbar not working

查看:102
本文介绍了jquery ui selectmenu滚动条不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jquery selectmenu插件。我已初始化选择

I use jquery selectmenu plugin. I have initialized select with

$('select').selectmenu({width:100, maxHeight:300, style: 'dropdown'});

我有很多选项,这会导致出现默认浏览器滚动条,但我无法使用它。如果我单击并尝试拖动此栏,则选择菜单关闭。我可以用鼠标滚轮滚动。 css和各种插件可能存在一些冲突。但我不知道从哪里开始寻找。

I have many options and this causes to appear default browser scrollbar, but i cant use it. If I click and try to drag this bar, selectmenu closes. I can scroll with mouse wheel. There might be some conflict in css and various plugins. But im not sure where to start looking.

任何想法,可能导致此问题的原因是什么?

Any ideas, what might be causing this problem?

推荐答案

这似乎是js文件的这一部分的一个问题:

It seems to be a problem in this section of the js file:

// document click closes menu
$( document ).bind( "mousedown.selectmenu-" + this.ids[ 0 ], function( event ) {
    //check if open and if the clicket targes parent is the same
    if ( self.isOpen && !$( event.target ).closest( "#" + self.ids[ 1 ] ).length ) {
        self.close( event );
    }
});

滚动条同意if子句中的条件,因此selectmenu已关闭......

The scrollbar agrees the condition in "if" clause, so selectmenu is closed...

您可以在if子句中注释该行,直到有人为此错误提供解决方案。这样,当您点击它时,selectmenu将不会关闭,但是当您选择任何选项时它将被关闭...

You can comment the line inside "if" clause until someone gives a solution for this bug. This way, the selectmenu won't be closed when you click out of it, but it will be closed when you select any option...

编辑:

好的,它现在正在运作。更改之前显示的部分:

Ok, it's working now. Change the section shown before by this one:

$( document ).bind( "mousedown.selectmenu-" + this.ids[ 0 ], function( event ) {
    //check if open and if the clicket targes parent is the same
    if ( self.isOpen && !$( event.target ).closest( "#" + self.ids[ 1 ] ).length && !$(event.target).hasClass('ui-selectmenu-menu-dropdown')) {
        self.close( event );
    }
});

这样,滚动条是div的一部分,类为ui-selectmenu-menu-dropdown ...移动滚动条时,不会关闭selectmenu。

This way, as the scrollbar is part of the div with class "ui-selectmenu-menu-dropdown"... selectmenu won't be closed when moving the scrollbar.

这篇关于jquery ui selectmenu滚动条不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆