2

Is it possible to browse months in datepicker, using swipe? For example in my iPhone, when I swiperight throw calendar it will show me next month. Please help me it is very important.

I tried to do something like this, but it is not working at all.

checkIn.datepicker(
{ 
    dateFormat: 'dd-mm-yy',
    firstDay: 1,
    minDate: 0,
    beforeShow: function()
    {
        jQuery('#ui-datepicker-div').on('swiperight', function() 
        {
            alert('next month');
        });
    }
});

1 Answers1

0

One of the possible approaches is to use TouchSwipe jQuery Plugin.

After including this to your project you can simply trigger click event on a corresponding arrow button like this:

$('#ui-datepicker-div').swipe({
        swipeRight:function(){
            $('#ui-datepicker-div').find("[data-handler='prev']").click();
        },
        swipeLeft:function(){
            $('#ui-datepicker-div').find("[data-handler='next']").click();
        }
})
Sumit Patel
  • 4,530
  • 1
  • 10
  • 28
Denis Petrov
  • 131
  • 4