SumoSelect处理事件不适用于Android设备

Laj*_*rek 6 javascript jquery plugins android sumoselect.js

我在我的select标签上使用SumoSelect v3.0.3(它可以进行多选选项),但我在Android设备上处理事件时遇到问题.关闭时alert(),不会出现选择标记.

只需要任何调用我的函数或触发关闭相扑选择.在Android和桌面上......

  • 适当的解决方案可以在较旧的3.0.2版本中...

有一个工作小提琴:LINK - 在桌面上打开和关闭选择输入后,您可以看到一个警告窗口,其中"下拉关闭!" 文本但在Android设备上你不会......

// .class pointing to <select> tag
$('.class').SumoSelect({placeholder: 'Select choice'});

$('select').on('sumo:closed', function(sumo) {

    alert("Drop down closed!");
});
Run Code Online (Sandbox Code Playgroud)

在桌面(Firefox/Chrome)上它可以工作......有什么建议吗?

我在javascript/jquery中相当弱,但在previsious版本(3.0.2)中,我$(document).trigger('sumoCloseSelect');在sumoselect.js插件中直接使用了自己的触发器(最后一行):

                showOpts: function () {
                var O = this;
                if (O.E.attr('disabled')) return; // if select is disabled then retrun
                O.is_opened = true;
                O.select.addClass('open');

                if(O.ftxt)O.ftxt.focus();
                else O.select.focus();

                // hide options on click outside.
                $(document).on('click.sumo', function (e) {
                    if (!O.select.is(e.target)                  // if the target of the click isn't the container...
                        && O.select.has(e.target).length === 0){ // ... nor a descendant of the container
                        if(!O.is_opened)return;
                        O.hideOpts();
                        $(document).trigger('sumoCloseSelect');
Run Code Online (Sandbox Code Playgroud)

(是非常脏),然后在我的main.js文件中:

$(document).on('sumoCloseSelect', function(e) {

    alert('Drop down closed!');
    ...
Run Code Online (Sandbox Code Playgroud)

但是这个解决方案也不适用于android ...

编辑:

我尝试将以下内容添加到sumoselect js文件中jQuery.myFunction();(如前面的例子),并在自己的js中定义它

    jQuery.myFunction= function(){
        alert('yep!');
    };
Run Code Online (Sandbox Code Playgroud)

再次对于台式机,它可以工作但不适用于Android ...

EDIT2:

使用init设置forceCustomRendering: true所有触发器都可以工作...但我想要启用此设置false(默认)

小智 0

你为什么要尝试用相扑插件来捕捉触发器?你到底想做什么?

例如你可以这样做

$(document).on('change', 'select.class', function(sumo) {
  alert("Drop down closed!");
});
Run Code Online (Sandbox Code Playgroud)

https://jsfiddle.net/5dy8j54n/14/