如何自定义数据报警器?
基本上,日期选择器现在看起来像像这样。需要它像这一样。
发布于 2015-11-23 11:45:51
您可以尝试如下:关于主题,请访问此处:http://jqueryui.com/themeroller/
使用像numberOfMonths一样的numberOfMonths: 2来显示两个月在一起。
jQuery(document).ready(function() {
var eventDates = {};
eventDates[ new Date( '11/26/2015' )] = new Date( '11/26/2015' );
eventDates[ new Date( '11/04/2015' )] = new Date( '11/04/2015' );
eventDates[ new Date( '12/17/2015' )] = new Date( '12/17/2015' );
// datepicker
jQuery('#dates').datepicker({
beforeShowDay: function( date ) {
var highlight = eventDates[date];
if( highlight ) {
return [false, "event", highlight];
} else {
return [true, '', ''];
}
},
numberOfMonths: 2
});
});<link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<html>
<head>
<style>
.event span {
background-color: #ff69b4 !important;
background-image :none !important;
color: #ff69b4 !important;
pointer-events: none;
cursor: default;
}
</style>
</head>
<body>
<table><tr>
<td><div style="height:20px !important;width:20px !important;background-color: #73AD21;border:solid gray 1px;"></div></td><td>available</td><td><div style="height:20px;width:20px;background-color: #FFC0CB;border:solid gray 1px;"></div></td><td>sold out</td></tr>
<tr><td colspan="4"><input type="text" id="dates"></td></tr>
</table>
</body>
</html>
发布于 2015-11-23 12:23:56
$(".selector").datepicker({numberOfMonths: 2});.ui-datepicker td.ui-state-disabled>span{background:#ff0000;}.ui-datepicker td.ui-state-disabled>span{color:#ff0000;}
或者这个回答的技术
.ui-datepicker td.ui-state-disabled{text-indent:100%; white-space:nowrap; overflow:hidden;}https://stackoverflow.com/questions/33868877
复制相似问题