每当我单击一个 div 容器时,都会打开一个 Jquery 对话框。除了 safari 浏览器之外,一切都很顺利。出于某种奇怪的原因,当我向下滚动时出现错误,我不知道我做错了什么。
我希望有人能帮我解决这个问题。
问题视频:https://streamable.com/89k8b
Jquery 对话框:
$(window).resize(function() {
$(".dialog").dialog("option", "position", {my: "center", at: "center", of: window});
});
$(document).ready(function(){
$( ".dialog" ).dialog({ dialogClass: 'fixed-dialog', autoOpen:false});
});
var opt = {
autoOpen: false,
closeText: '<?php echo $lang["23"]; ?>',
width: 950,
height: 600,
title: null,
draggable: false,
modal: true,
create: function (event) { $(event.target).parent().css({ 'position': 'fixed', 'z-index': '10', 'top': '50%', 'margin-top': '-350px', 'left': '50%;', 'margin-left': '-1000px' }); },
buttons:
[
{
text: "<?php echo $lang["44"]; ?>",
click: function()
{
$('.dialog').dialog('close');
}
}
]
}
jQuery(function () {
jQuery('.dialog').dialog(opt);
})
html:
<div onclick="$('#dialog-<?php echo $hotel['ms_id']; ?
>').dialog('open').dialog(opt)
最佳答案
改变
position: 'fixed'
到
position: 'absolute'
这应该可以解决您的问题
关于javascript - 在 safari 上滚动,Jquery 对话框无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48520444/