开发者

Jquery datepicker 2 months display

开发者 https://www.devze.com 2023-01-25 23:33 出处:网络
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 ri

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?


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

Initialize a datepicker with the numberOfMonths option specified.

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

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

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


Here is a very simple jQuery Datepicker with multiple months display option:

Demo

Source below:

Source

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号