【发布时间】:2014-03-05 05:27:42
【问题描述】:
我想滚动包含 iframe 的页面。 当 iframe 加载包含 Jquery 代码的页面时,我希望我的父页面滚动到顶部。
这是我现在正在使用的代码,但它不起作用:
<HTML>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
window.parent.$("body").animate({scrollTop:0}, 'slow');
}
</script>
</head>
我的错误在哪里?为什么当 iframe 页面加载此页面时,父页面不会置顶?
提前谢谢你!
【问题讨论】: