javascript - Jquery Mobile Datepicker change month on swipe -


is there way change datepicker's month on swipe? mean way display next , previous month on swipe?

here approach:

jquery mobile swipe:

// bind swipehandler callback function swipe event on div.box $( "#main-page" ).on( "swipeleft", swipelefthandler ).on( "swiperight", swiperighthandler );  function swipelefthandler( event ){ //    $( event.target ).addclass( "swipe" );     console.log('swiped left'); }  function swiperighthandler( event ){ //    $( event.target ).addclass( "swipe" );     console.log('swiped right'); } 

and here jquery mobile datepicker code:

$(".date-input-inline").datepicker({     onchangemonthyear: function(year, month, inst) {          $(".ui-datepicker").fadeout(0);          $(".ui-datepicker").fadein("normal");      },     dateformat: 'yy-mm-dd',     yearrange: currenty + ':' + currenty, }); 

use getdate method date, add month , set using setdate method set new date.

here's example swipe right:

 var thedate=$(".date-input-inline").datepicker('getdate'); //get date datepicker  thedate.setmonth(thedate.getmonth()+1); //add month   $(".date-input-inline").datepicker('setdate',thedate); // set date in datepicker 

swipe left have same type of code, need subtract month.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -