Datepicker (month and year) not working inside fancybox

倾然丶 夕夏残阳落幕 提交于 2019-12-25 08:48:19

问题


I am having a problem with my fancybox 3 and jquery ui datepicker. if I place the datepicker outside the fancybox.. the dropdown for months and years are working.. but when I place it inside fancybox. the dropdown is not being triggered. any idea what is happening?

$("#Date_To").datepicker({changeMonth: true,changeYear: true});

image


回答1:


Try disabling focusing, something like this:

$('[data-fancybox]').fancybox({
    autoFocus : false,
    trapFocus : false,
    touch     : false,
    beforeClose : function() {
        $( ".selector" ).datepicker( "hide" );
    }
});

Demo - https://codepen.io/fancyapps/pen/QqLXaz




回答2:


I tried using modal and found a solution. is there any way I can covert this code for fancybox?

var enforceModalFocusFn = $.fn.modal.Constructor.prototype.enforceFocus;

$.fn.modal.Constructor.prototype.enforceFocus = function() {};

$confModal.on('hidden', function() { $.fn.modal.Constructor.prototype.enfor



来源:https://stackoverflow.com/questions/46170067/datepicker-month-and-year-not-working-inside-fancybox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!