Jquery datepicker 2 months display

倖福魔咒の 提交于 2021-02-07 03:22:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!