【问题标题】:jQuery datepicker swipejQuery 日期选择器滑动
【发布时间】:2014-03-23 20:26:30
【问题描述】:

是否可以使用滑动浏览日期选择器中的月份? 例如,在我的 iPhone 中,当我向右滑动日历时,它会在下个月显示给我。 请帮帮我,这很重要。

我试图做这样的事情,但它根本不起作用。

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

【问题讨论】:

标签: jquery datepicker swipe-gesture


【解决方案1】:

其中一种可能的方法是使用TouchSwipe jQuery Plugin

将它包含到您的项目后,您可以简单地触发相应箭头按钮上的点击事件,如下所示:

$('#ui-datepicker-div').swipe({
        swipeRight:function(){
            $('#ui-datepicker-div').find("[data-handler='prev']").click();
        },
        swipeLeft:function(){
            $('#ui-datepicker-div').find("[data-handler='next']").click();
        }
})

【讨论】:

    猜你喜欢
    • 2012-09-11
    • 2011-11-06
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多