我花了幾個小時試圖讓任何新的時間選擇器工作(以前使用https://github.com/weareoutman/clockpicker這是偉大的,但總是在手機屏幕上)。我可以通過點擊輸入字段來獲取時間點擊器嗎?
大多數似乎是Bootstrap 2.x,我無法得到任何工作。終於拿到https://github.com/Eonasdan/bootstrap-datetimepicker去(在移動不是很大,但...)
我的問題是我有很多的日期微小input
領域的,所以我需要擺脫glyphicon的,只是onclick
在input
領域本身。
我已經加入了我的小測試頁面,以防其他任何人苦苦掙扎。我沒有意識到我需要moment.js,這讓我非常惱火30分鐘。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="/beta022/bootstrap/css/bootstrap.css" />
<link type="text/css" rel="stylesheet" href="/beta022/bootstrap/css/bootstrap-datetimepicker.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="/beta022/bootstrap/js/moment.js"></script>
<script type="text/javascript" src="/beta022/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="/beta022/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class='col-sm-6'>
<form class="form">
<div class="form-group">
<div class='input-group date' id='datetimepicker4'>
<input type='text' class="form-control" />
<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
</form>
</div>
<script type="text/javascript">
$(function() {
$('#datetimepicker4').datetimepicker({
pickDate: false, minuteStepping:5,
});
});
</script>
</div>
</div>
</html>
編輯:這已經超出怪異。擺脫了圖形。把其他span
圍繞input
。工程,但有一個很大的醜陋邊界。試圖禁用input-group-addon
class
通過將其更改爲adxxdon並完美工作(以及沒有圓角)。然後我嘗試沒有這個class
,它停止工作。所以看起來像regex
span
內正在進行。
我很好的結束了我的JS/CSS能力。如果任何人有一個更整潔的解決方案,我將不勝感激。
謝謝你們(gals)。根本沒有看到。 – BeNice 2014-12-03 10:44:56