选择框全屏jquery引导程序

Select box fullscreen jquery bootstrap

本文关键字:jquery 引导程序 选择      更新时间:2024-02-12

我发现了一种适用于手机的全屏selextbox方法。

http://craftpip.github.io/bootstrap-fullscreen-select/

但是,当我在选择框上添加表单操作并单击选择选项时,弹出窗口会打开,在我选择某个值之前,它会直接重定向到表单操作。

知道我该怎么解决这个问题吗?

<link href="http://www.jqueryscript.net/demo/Mobile-First-Fullscreen-Select-Replacement-with-jQuery-Bootstrap/css/bootstrap-fullscreen-select.css" rel="stylesheet" type="text/css">
<form action="index.html">
    <select class="form-control example-1" >
    <option value="JavaScript">JavaScript</option>
    <option value="C++">C++</option>
    <option value="Swift">Swift</option>
    <option value="Ruby">Ruby</option>
    <option value="Python">Python</option>
</select>
  </form>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="http://www.jqueryscript.net/demo/Mobile-First-Fullscreen-Select-Replacement-with-jQuery-Bootstrap/js/bootstrap-fullscreen-select.js"></script>
<script>
$('.example-1').mobileSelect();
$('.example-2').mobileSelect({theme: 'holo',style: 'btn-danger'});
$('.example-3').mobileSelect({theme: 'mac', animation: 'zoom'});
</script>

有趣的是,我从未使用过这个插件,所以我不得不仔细研究一下源代码。无论如何,您的原生选择正在转换为按钮。表单中的按钮将提交。将这个片段添加到您自己的js文件中。

$(document).ready(function(){
    $('.btn-mobileSelect-gen').attr('type', 'button');
});

我把你的小提琴叉在这里-工作演示