问题描述
我正在使用jquery-ui datepicker显示多个月.
I'm using the jquery-ui datepicker for displaying multiple months.
弹出窗口将这些月份显示在另一个月份的下方,是否可以将下个月显示在右侧?
The popup displays these months 1 below the other, is there a way to have the following month displayed to the right instead?
推荐答案
我现在正在datePicker中使用它:)那么,根据jQuery dataPicker文档:
I'm working with this in datePicker right now :) So, well, according to jQuery dataPicker documentation:
numberOfMonths
Number, Array
Default:1
设置一次显示多少个月.该值可以是一个正整数,也可以是两个元素的数组,以定义要显示的行数和列数.代码示例
Set how many months to show at once. The value can be a straight integer, or can be a two-element array to define the number of rows and columns to display. Code examples
使用指定的numberOfMonths
选项初始化日期选择器.
Initialize a datepicker with the numberOfMonths
option specified.
$( ".selector" ).datepicker({ numberOfMonths: [2, 3] });
在初始化后获取或设置numberOfMonths选项.
Get or set the numberOfMonths option, after init.
//getter
var numberOfMonths = $( ".selector" ).datepicker( "option", "numberOfMonths" );
//setter
$( ".selector" ).datepicker( "option", "numberOfMonths", [2, 3] );
就像我尝试过的那样,如果你写
So as fas as I tried if you write
$( ".selector" ).datepicker({ numberOfMonths: 2 });
它连续2个月水平出现.而且,如果要垂直显示它们,则应在列中输入
it appears 2 months, one by the side of the other, in a row, horizontally. And In the case you want to display them vertically, in a column you should write
$( ".selector" ).datepicker({ numberOfMonths: [2, 1] });
这篇关于jQuery datepicker 2个月显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!