[英]How do I stop a Wordpress page from jumping/scrolling to an iframe?
I have a Wordpress site, and a small iframe towards the bottom of the page. 我有一个Wordpress网站,并且页面底部有一个小的iframe。 Whenever the page loads it jumps to where the iframe is.
每当页面加载时,它都会跳转到iframe所在的位置。
I've tried hiding the element and adding a javascript function 我试图隐藏元素并添加javascript函数
HTML 的HTML
<iframe id="iframe_wrapper" src="link-here" frameborder="0"
scroll="no" onload="showOnLoad();"></iframe>
CSS 的CSS
#iframe_wrapper {display:none;}
JS JS
function showOnLoad() {
document.getElementById("iframe_wrapper").style.display = 'block';
}
The iframe appears, but it dind't fix the jumping issue. iframe出现了,但是并没有解决跳跃问题。
plz add "opacity:0" instead of "display:none".. check the below code.. 请添加“ opacity:0”而不是“ display:none” ..检查以下代码。
css 的CSS
#iframe_wrapper {
opacity:0;
}
js js
function showOnLoad() {
document.getElementById("iframe_wrapper").style.opacity= '1';
}
you can set the height to 1px 您可以将高度设置为1px
#iframe_wrapper {
height:1px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.