亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

基于Bootstrap實現(xiàn)的下拉菜單手機端不能選擇菜單項的原因附解決辦法

 更新時間:2016年07月22日 14:37:27   投稿:mrr  
小編使用bootstrap做的下拉菜單在電腦瀏覽器中可以正常使用,在手機瀏覽器中能彈出下拉列表卻不能選擇列表中的菜單項,怎么回事,如何解決呢?下面小編給大家分享下具體原因及解決辦法,一起看下吧

基于Bootstrap做的下拉菜單在電腦瀏覽器中可正常使用,在手機瀏覽器中能彈出下拉列表,卻不能選擇列表中的菜單項,通過自己百度查找原因?qū)ootstrap腳本文件中的ontouchstart 替換為 disable-ontouchstart可以解決,替換后并不能解決。(紅米手機UC瀏覽器不支持,小米手機UC瀏覽器正常,其他暫時未測試)

jquery:v1.11.2

bootstrap:v3.3.4

以下為前臺頁面代碼:

<div class="input-group">
<span class="input-group-addon" id="sizing-addon2">本外地福利:</span>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" id="btnFuLi" name="btnFuLi" data-toggle="dropdown"
value="" aria-expanded="false">
請選擇本外地福利… <span class="caret"></span>
</button>
<ul class="dropdown-menu" id="UiFuLi" role="menu">
<li><a title='1' href='#'>本地福利</a></li><li class='divider'></li>
<li><a title='2' href='#'>外地福利</a></li><li class='divider'></li> 
</ul>
<input id="txtFuLi" name="本外地福利"/>
</div>
</div>

以下為JS腳本:(給下拉菜單項添加click)

DataBindFuLi: function () {
$("#UiFuLi li a").bind("click", function () {
var $this = $(this);
var $a = $this.parent().parent().prev()
var t = $this.text();
$a.val($this.attr('title'));
$('#txtFuLi').val($this.attr('title'));
$a.text($this.text());
$a.append("<span class='caret'>");
});
}

解決方法如下所示:

以下代碼手機瀏覽器不支持,將以下元素指定ID賦值即可解決()

$this.parent().parent().prev()

調(diào)整后代碼:

$("#drpWorkType li a").bind("click", function () {
var $this = $(this);
//var $a = $this.parent().parent().prev()
$('#txtWorkType').val($this.attr('title'));
$('#btnWorkType').val($this.attr('title'));
$('#btnWorkType').text($this.text());
//$a.val($this.attr('title'));
//$a.text($this.text());
//$a.append("<span class='caret'>");
});

以上所述是小編給大家介紹的基于Bootstrap實現(xiàn)的下拉菜單手機端不能選擇菜單項的原因附解決辦法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關文章

最新評論