2015-05-21 12 views
12

我使用脚本“core ui select”在我的网站上设置我的表单样式。对于桌面用户来说,一切工作都很好,但是一段时间以来有很多用户使用手机的报告。他们说他们无法修改选项,因为它是灰色的。Core ui选择不适用于移动用户

所以我做了测试使用名为“默认用户代理”的Firefox插件,我将我的浏览器代理切换到iPhone。后来我意识到,整个窗体停止工作,但只针对移动用户

这是一个测试页面,如果你想看到的问题生活(你必须改变你的用户代理重现bug): https://www.ni-dieu-ni-maitre.com/test_mobile.php

这里是页面的代码。

<script type="text/javascript" src="https://www.no-gods-no-masters.com/scripts/jquery-1.8.2.min.js"></script> 
<link href="https://www.no-gods-no-masters.com/scripts/css/core-ui-select.css" media="screen" rel="stylesheet" type="text/css"> 
<link href="https://www.no-gods-no-masters.com/scripts/css/jquery.scrollpane.css" media="screen" rel="stylesheet" type="text/css"> 
    <script> 
    $(document).ready(function(){ 
     $('#impression').coreUISelect(); 
    }); 
    </script> 
</head><body> 

<select class="b-core-ui-select__dropdown" name="impression" id="impression"> 
<option>Printing on front</option> 
<option>Printing on back</option> 
</select> 

<script src="https://www.no-gods-no-masters.com/scripts/js/jquery.core-ui-select.js"></script> 
</body> 
</html> 
+0

我刚刚意识到,即使是核心UI选择脚本的演示页面也有这个bug ...所以这不是我的网站的错误,但与核心UI选择脚本...有人知道如何解决这个 ?我可以支付工作 – libertaire

+0

UI核心并非真正为移动设计。你可以试试这个:http://touchpunch.furf.com/我添加了这个小脚本来使用uicore滑块,并且在需要测试的所有移动设备上都能很好地工作,包括iPAD,iPhone,Samsung galaxy s3-4-5。希望有所帮助 – Bene

回答

5

这不是一个错误。在移动设备上执行时,插件(core-ui-select)会显式跳过用于显示下拉列表的DOM操作代码。

看到这一点,你可以设置jquery.core-UI-select.js行号断点176

CoreUISelect.prototype.showDropdown = function() { 
     this.domSelect.focus(); 
     this.settings.onOpen && this.settings.onOpen.apply(this, [this.domSelect, 'open']); 
     if($.browser.mobile) return this; //176: this skips the rest on mobile 
     if(!this.isSelectShow) { 
      this.isSelectShow = true; 
      this.select.addClass('open'); 
      this.dropdown.addClass('show').removeClass('hide'); 
      if(this.isJScrollPane) this.initJScrollPane(); 
      this.scrollToCurrentDropdownItem(this.dropdownItem.eq(this.getCurrentIndexOfItem())); 
      this.updateDropdownPosition(); 
     } 
    } 

上线176的评价:挖掘时$.browser.mobile计算结果为真(我模拟了移动设备在Chrome中),其余代码因此被跳过。

修复:删除线显示下拉就好。