jquery - How to get scrollTop of an iframe -
When there is an iframe, jQuery's scrolltwork returns returns to find out how to remove the scrollbar of an iframe Is anyone capable?
More information:
My script is only running in iframe, the parent window is on another domain, so I can not see the id of the iframe or anything like that < / P>
You can set scrollTop
using this setup:
$ ("html, body"). ScrollTop (25);
So you can try to get it in such a way:
$ ("html, body"). ScrollTop ();
Because different browsers set scrollTop
on different elements (body or HTML).
From the scrollTo plugin:
But this will probably still fail in some browsers. Here is the section related to the source code:
// Returns the real elements to scroll, hack, hack :) // scrolls (supports windows / iframes, documents and regular nodes ) $ .fn._scrollable = function () {return.map (function () {var elem = this, isWin =! Elem.nodeName || $ .inArray (elem.nodeName.toLowerCase), ['iframe', ' #documents', 'html', 'body'])! = -1; If (! ISIN) {return AMM;} var doc = (elem.contentWindow || elem) .document || Elem.ownerDocument || Elem; $ .browser.safari return || Doc.compatMode == 'BackCamppet'? Doc.body: doc.documentElement;}); };
You can then run:
$ (window) ._ scroll (). ScrollTop ();
To determine how far the iframe is scrolled.
Comments
Post a Comment