Twipped / Kalendae

A javascript date picker that just works.
MIT License
1.99k stars 285 forks source link

Switch between month counts #192

Closed amylaun closed 8 years ago

amylaun commented 8 years ago

Hi, I was wondering if it is possible to switch between month counts after a calendar has been initialized.

I'd like to responsively show 1-3 calendars on mobile, tablet, desktop. I could initialize them differently based on the width of the window on load, but was hoping to do it as the window is resized. Is this something that is possible within the current project? Or would it be best to just delete the existing calendar and reinitialize?

var calendar = new Kalendae({ months: 3, mode:'range', });

calendar.settings.months = 1; calendar.draw();

Twipped commented 8 years ago

In theory changing the settings.months value and redrawing should work, but I've never tried it so I don't know for certain. There's no other specific provision for that.

You could have the calendar draw the maximum months and then use css media queries to hide the other months. Again tho, I've never tried it, so I don't know how well it will work.

pankajpatel commented 7 years ago

The draw() function doesn't redraw the calendar. And the arrows are owned by the edge months on the range of all months rendered, the media query becomes very clumsy.