$(".date-range").daterangepicker( { format: 'YYYY-MM-DD', autoUpdateInput: false, locale: { cancelLabel: 'Clear' }, endDate: new Date(), maxDate: new Date(), locale: { applyLabel: '确认', cancelLabel: '取消', fromLabel: '从', toLabel: '到', weekLabel: 'W', customRangeLabel: 'Custom Range', daysOfWeek: ["日", "一", "二", "三", "四", "五", "六"], monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], } }); $('.date-range').on('apply.daterangepicker', function (ev, picker) { $(this).val(picker.startDate.format('YYYY-MM-DD') + ' / ' + picker.endDate.format('YYYY-MM-DD')); $('#searchform').submit(); }); $('.main').scroll(function () { var date = $('.date-range').offset().top; $('.daterangepicker').css('top', date + 41) });