如何滚动流 JQuery UI 对话框
我一直在尝试使用跟随滚动来与用户滚动一起移动对话框,但没有成功
<script>
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-report-problem-form" ).dialog({
autoOpen: true,
height: 550,
width: 700,
modal: true,
buttons: {
"<?= $this->translate('REPORT_PROBLEM'); ?>": function() {
reportProblem();
},
"<?= $this->translate('CANCEL'); ?>": function() {
$( this ).dialog( "close" );
}
},
close: function() {
}
});
$.scrollFollow("#dialog-report-problem-form",{speed: 10});
});
</script>
。
<div id="dialog-report-problem-form" title="<?= $this->translate('REPORT_PROBLEM'); ?>">
<?= $this->form ?>
</div>
我收到错误
box.cont.offset() is null
有谁知道如何修复或另一个基于 jquery 的解决方案来跟踪用户滚动?
I have been trying to use follow scroll to move dialog together with user scroll but no success
<script>
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-report-problem-form" ).dialog({
autoOpen: true,
height: 550,
width: 700,
modal: true,
buttons: {
"<?= $this->translate('REPORT_PROBLEM'); ?>": function() {
reportProblem();
},
"<?= $this->translate('CANCEL'); ?>": function() {
$( this ).dialog( "close" );
}
},
close: function() {
}
});
$.scrollFollow("#dialog-report-problem-form",{speed: 10});
});
</script>
.
<div id="dialog-report-problem-form" title="<?= $this->translate('REPORT_PROBLEM'); ?>">
<?= $this->form ?>
</div>
I have been receiving the error
box.cont.offset() is null
Does anyone knows how could fix or another jquery based solution to follow user scroll?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
插件 scrollFollow 似乎有很多错误,并且
$.scrollFollow()
一起使用时,开发已停止(最后一次更新于 2008 年),默认选项值未设置,因此你会遇到很多像你遇到的错误。$(...).scrollFollow
一起使用时,主选项 container 未正确获取,因此它实际上不起作用...这是一个小脚本,当窗口滚动时,将移动对话框:
jsfiddle 上的工作示例。
The plugin scrollFollow seems to be pretty buggy and development discontinued (last update in 2008)
$.scrollFollow()
, the default option values are not set so you get a lot of errors like the one you got.$(...).scrollFollow
, the main option container is not obtained correctly so it does not really work...Here is a small script that will move the dialog around when the window is scrolled:
Working example on jsfiddle.