Sto*_*per 14 html javascript jquery jquery-ui datepicker
不知何故,我的jQuery UI Datepicker月/年下拉列表在最新的Firefox中没有任何弹出窗口.
当我点击月份或年份下拉列表时,不会显示选项列表.
这是我的Popup和Datepicker代码:
$( "#dialog-form" ).dialog({
modal: true
});
$("#datepicker").datepicker({
changeMonth: true,
changeYear: true
});
Run Code Online (Sandbox Code Playgroud)
我也在JSfiddle上准备了一个演示:
Vij*_*jay 19
这是因为模态强调对自身的关注.这是这里提到的解决方案.将以下脚本添加到js文件中.而已.
jsfiddle:http://jsfiddle.net/surjithctly/93eTU/16/
// Since confModal is essentially a nested modal it's enforceFocus method
// must be no-op'd or the following error results
// "Uncaught RangeError: Maximum call stack size exceeded"
// But then when the nested modal is hidden we reset modal.enforceFocus
var enforceModalFocusFn = $.fn.modal.Constructor.prototype.enforceFocus;
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
$confModal.on('hidden', function() {
$.fn.modal.Constructor.prototype.enforceFocus = enforceModalFocusFn;
});
$confModal.modal({ backdrop : false });
Run Code Online (Sandbox Code Playgroud)
ShA*_*KiR 10
我不得不使用
$.fn.modal.Constructor.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.focus()
}
}, this))
}
Run Code Online (Sandbox Code Playgroud)
当我们使用Tab来聚焦元素时(从GIT获得),以限制模型内的焦点.
试过这个>>
$("#dateOfBirth").datepicker({
beforeShow: function(input, inst) {
$(document).off('focusin.bs.modal');
},
onClose:function(){
$(document).on('focusin.bs.modal');
},
changeYear: true,
yearRange : '-150:+0'
});
Run Code Online (Sandbox Code Playgroud)
现在我可以选择年份:)
| 归档时间: |
|
| 查看次数: |
16595 次 |
| 最近记录: |