jquery datepicker 2个月显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4217203/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 16:51:30  来源:igfitidea点击:

Jquery datepicker 2 months display

jqueryjquery-ui-datepicker

提问by Eric

I'm using the jquery-ui datepicker for displaying multiple months.

我正在使用 jquery-ui 日期选择器来显示多个月份。

The popup displays these months 1 below the other, is there a way to have the following month displayed to the right instead?

弹出窗口将这些月份 1 显示在另一个下方,有没有办法让下个月显示在右侧?

回答by David

I'm working with this in datePicker right now :) So, well, according to jQuery dataPicker documentation:

我现在正在 datePicker 中处理这个 :) 所以,好吧,根据 jQuery dataPicker 文档:

numberOfMonths

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

设置一次显示多少个月。该值可以是一个直整数,也可以是一个二元素数组,用于定义要显示的行数和列数。代码示例

Initialize a datepicker with the numberOfMonthsoption specified.

使用numberOfMonths指定的选项初始化日期选择器。

$( ".selector" ).datepicker({ numberOfMonths: [2, 3] });

Get or set the numberOfMonths option, after init.

在 init 之后获取或设置 numberOfMonths 选项。

//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 }); 

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

它出现 2 个月,一个在另一个的旁边,连续,水平。如果你想垂直显示它们,你应该在一列中写

$( ".selector" ).datepicker({ numberOfMonths: [2, 1] });

回答by Aditya P Bhatt

Here is a very simple jQuery Datepickerwith multiple months display option:

这是一个非常简单jQuery Datepickermultiple months display option

Demo

演示

Source below:

来源如下:

Source

来源