如果我在哪里,我会在滚动和调整大小时关闭 DatePicker,可能没人会介意,因为它也会关闭onblur()
看看这个小提琴:http: //jsfiddle.net/PFVxK/1325/
$(".fancybox-effects-b").fancybox({
openEffect: 'none',
closeEffect: 'none',
helpers: {
title: {
type: 'over'
}
},
afterLoad: function () {
$('.fancybox-inner').on('scroll', function () {
CloseDatePicker();
});
}, beforeClose: function () {
$('.fancybox-inner').off('scroll');
}
});
$(function() {
$( "#dateofbirth" ).datepicker();
/*Load only inside fancybox*/
$(window).resize(function(){
CloseDatePicker();
});
});
function CloseDatePicker()
{
if($("#dateofbirth").datepicker( "widget" ).is(":visible"))
{
$("#dateofbirth").datepicker("widget").hide();
$("#dateofbirth").trigger( "blur");
}
}