如何在HTML iFrame中检测滚动条的存在(使用Javascript)?
我已经尝试过了:
var vHeight = 0;
if (document.all) {
if (document.documentElement) {
vHeight = document.documentElement.clientHeight;
} else {
vHeight = document.body.clientHeight
}
} else {
vHeight = window.innerHeight;
}
if (document.body.offsetHeight > vHeight) {
//when theres a scrollbar
}else{
//when theres not a scrollbar
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
this.scrollLeft=1;
if (this.scrollLeft>0) {
//when theres a scrollbar
this.scrollLeft=0;
}else{
//when theres not a scrollbar
return false;
}
Run Code Online (Sandbox Code Playgroud)
没有成功..
我在DOM Inspector上搜索了javascript objets,但没有找到任何内容.
是否可以在javacscript中检测iframe中的滚动条存在?
iframe内容来自同一个域.
直到现在都没有成功..