Javascript 来自iframe的页面顶部
有没有办法在iframe中创建链接来控制主页。我需要从iframe做一个链接,使主页进入顶部 比如说Javascript 来自iframe的页面顶部,javascript,jquery,html,iframe,Javascript,Jquery,Html,Iframe,有没有办法在iframe中创建链接来控制主页。我需要从iframe做一个链接,使主页进入顶部 比如说 <html> <- mainpage ...some arcticle... <iframe> ...long article... <a href="goback">Go Back</a> </iframe> </html> 您可以使用元素中的id属性跳到页面顶部 <html id
<html> <- mainpage
...some arcticle...
<iframe>
...long article...
<a href="goback">Go Back</a>
</iframe>
</html>
您可以使用元素中的id
属性跳到页面顶部
<html id="top">
<!-- Some content here -->
<iframe>
<!-- Long Article here -->
<a href="#top">Jump to top</a>
</iframe>
</html>
您可以使用元素中的id
属性跳转到页面顶部
<html id="top">
<!-- Some content here -->
<iframe>
<!-- Long Article here -->
<a href="#top">Jump to top</a>
</iframe>
</html>
这不能在iframe中完成。您无法从父页面控制iframe,反之亦然。这不能在iframe中完成。您无法从父页面控制iframe,反之亦然。我认为它可以工作
$(文档).ready(函数(){
$(窗口)。滚动(函数(){
如果($(this).scrollTop()>100){
$('.scrollup').fadeIn();
}否则{
$('.scrollup').fadeOut();
}
});
$('.scrollup')。单击(函数(){
$(“html,body”).animate({
滚动顶部:0
}, 600);
返回false;
});
});
我认为它是有效的
$(文档).ready(函数(){
$(窗口)。滚动(函数(){
如果($(this).scrollTop()>100){
$('.scrollup').fadeIn();
}否则{
$('.scrollup').fadeOut();
}
});
$('.scrollup')。单击(函数(){
$(“html,body”).animate({
滚动顶部:0
}, 600);
返回false;
});
});
iframe中的链接应如下所示
<a href="http://full-address-of-the-parent-page/#top" target="_parent">go back</a>
iframe中的链接应如下所示
<a href="http://full-address-of-the-parent-page/#top" target="_parent">go back</a>