我試圖用jquery-ui-1.8.17顯示和設置12個月日期選擇日曆。 在Styling the jQueryUI DatePicker的幫助下,日曆最初顯示正常,即它顯示了3行中的完整年份,每行包含4個月。 但是,當我點擊日曆中的一天時,顯示器跳轉到包含12個月的1行! 任何人看到這種奇怪的行爲也有或有解決辦法?jQueryUI DatePicker在日期點擊12個月查看「跳轉」
注意:在我的代碼中,我包含了jquery-ui-1.8.17.custom.css。這是與http://jqueryui.com/themeroller生成的文件。請參閱css文件中的鏈接。
下面是完整的代碼
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" media="screen" href="http://www.j2u.nl/jquery-ui-1.8.17.custom.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://jquery-ui.googlecode.com/svn-history/r3982/trunk/ui/i18n/jquery.ui.datepicker-nl.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$(".datepicker").datepicker ({
dateFormat: 'dd-MM-yy',
firstDay: 1, // rows starts on Monday
minDate: new Date(),
maxDate: '+1Y',
numberOfMonths: 12
});
$(".ui-datepicker-inline").width("850px");
$(".ui-widget").css("font-size","0.9em");
});
</script>
</head>
<body>
<p><div class="datepicker"></div></p>
</body>
</html>
請張貼一個例子或你的代碼的其餘部分,包括CSS。我拋出了你在jsFiddle上發佈的內容並獲得了一個長長的幾個月。 – j08691 2012-04-17 20:33:31
現在添加完整的代碼!另外作爲一個小提琴:http://jsfiddle.net/r7pEe/ – rwijngaa 2012-04-18 17:01:46