Jquery 引导窗体助手时间选择器在我的手机上不工作
我已经实现了,它在我的桌面浏览器上按预期工作。代码如下:Jquery 引导窗体助手时间选择器在我的手机上不工作,jquery,html,twitter-bootstrap,Jquery,Html,Twitter Bootstrap,我已经实现了,它在我的桌面浏览器上按预期工作。代码如下: <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" class="form-horizontal" role="form"> <div class="form-group"> <label for="start_time" class="col-sm-2 con
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" class="form-horizontal" role="form">
<div class="form-group">
<label for="start_time" class="col-sm-2 control-label">Start time</label>
<div class="col-sm-10">
<div class="bfh-timepicker" id="start_time" data-name="start_time">
</div>
</div>
</div>
</form>
结果是:
这是我单击它时的结果:
正如我所说,这在我的桌面浏览器Google Chrome上运行良好。但是在我使用谷歌Chrome的HTC One手机上,时间选择器工作不正常。我可以像第一幅图那样单击它,但是当我尝试使用上下箭头输入时间时,什么也没有发生
如何解决此问题
编辑:使用IE在我的手机上试用过,仍然存在相同的问题。如评论中所述,使用此插件似乎没有什么支持。最后我改用了。第一次更改
.on('mousedown.bfhnumber.data-api', '.inc', BFHNumber.prototype.btninc)
.on('mousedown.bfhnumber.data-api', '.dec', BFHNumber.prototype.btndec);
到
然后找到btninc和btndec函数
评论
$this.increment();
$this.decrement();
将etInterval精细更改为setTimeout
您的代码如下所示:
btndec: function() {
var $this,
timer;
$this = $(this).parent().find('.bfh-number').data('bfhnumber');
if ($this.$element.is('.disabled') || $this.$element.attr('disabled') !== undefined) {
return true;
}
// $this.decrement();
timer = setTimeout(function() {
var interval;
interval = setTimeout(function() {
$this.decrement();
}, 0);
$this.$element.data('interval', interval);
}, 600);
$this.$element.data('timer', timer);
$(document).one('mouseup', {btn: $this}, BFHNumber.prototype.mouseup);
return true;
}
是的,那似乎根本不起作用。在我的Nexus5上,演示站点在Chrome中不起作用。我建议使用一个不同的插件,因为开发人员显然没有让这个插件工作得很好。@BillyMoat这很遗憾,我真的很喜欢它。你有什么建议吗?也许这个:我以前用过那个,但它只用于日期:我需要时间输入,HH:mm风格@不幸的是,它不再被支持了,但我发现了这个:它非常适合我。包括这个和你的第一个评论作为回答,我会接受它:P@BillyMoat
btndec: function() {
var $this,
timer;
$this = $(this).parent().find('.bfh-number').data('bfhnumber');
if ($this.$element.is('.disabled') || $this.$element.attr('disabled') !== undefined) {
return true;
}
// $this.decrement();
timer = setTimeout(function() {
var interval;
interval = setTimeout(function() {
$this.decrement();
}, 0);
$this.$element.data('interval', interval);
}, 600);
$this.$element.data('timer', timer);
$(document).one('mouseup', {btn: $this}, BFHNumber.prototype.mouseup);
return true;
}