问题
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?
回答1:
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] });
回答2:
Here is a very simple jQuery Datepicker
with multiple months display option
:
Demo
Source below:
Source
来源:https://stackoverflow.com/questions/4217203/jquery-datepicker-2-months-display