How can I detect a Scrollbar presence ( using Javascript ) in HTML iFrame ?
I have already tried :
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 }
And I also had tried :
this.scrollLeft=1; if (this.scrollLeft>0) { //when theres a scrollbar this.scrollLeft=0; }else{ //when theres not a scrollbar return false; }
With no success..
I have searched the javascript objets on DOM Inspector, but didn't find anything.
Is is possible to detect a scrollbar presence in a iframe in javacscript ?
The iframe content comes from the same domain.
No success until now..
alt text http://www.upvtp.com.br/file.php/1/help_key.jpg
var root= document.compatMode=='BackCompat'? document.body : document.documentElement; var isVerticalScrollbar= root.scrollHeight>root.clientHeight; var isHorizontalScrollbar= root.scrollWidth>root.clientWidth;
This detects whether there is a need for a scrollbar. For the default of iframes this is the same as whether there is a scrollbar, but if scrollbars are forced on or off (using the ‘scrolling="yes"/"no"’ attribute in the parent document, or CSS ‘overflow: scroll/hidden’ in the iframe document) then this may differ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With