javascript - Why isn't the scrollTo() method working for iframes? -


no matter do, iframe not auto scroll bottom. can't scrollto() iframe. i've checked lot of other pages on stack overflow dealing similar problems. none of solutions have worked me. may case i'm not implementing them correctly.

scrolling iframe javascript? working example given in above post not in fact work me. no matter numbers input scrollto() method in example nothing changes.

<!doctype html> <html> <body>  <div id="divy"> <iframe id='cat' src='test.html'></iframe> </div> <script> console.log(document.getelementbyid('cat'));  document.getelementbyid("cat").onload = function () {     this.contentwindow.scrollto(0, 200) };  conslole.log( document.getelementbyid("cat").onload = function () {     this.contentwindow.scrollto(0, 200)) };      //setinterval(function(){  document.getelementbyid("divy").innerhtml="    <iframe src='test.html'></iframe>"; }, 3000); </script> <body> </html> 

edit: still don't know why code in working example on other post doesn't work me. mentioned in comments post didn't work them either.

my first 2 problems don't know how use console log, , had typo. believe main problem never entered big enough value see scroll bar move , thought wasn't working. size of file loading 150 pixels way small. code below works me.

<!doctype html> <html> <body>  <div id="divy"> <iframe id='cat' src='test.html'></iframe> </div> <script> console.log(document.getelementbyid('cat'));  document.getelementbyid("cat").onload = function () {     this.contentwindow.scrollto(0, 1000000) };       //setinterval(function(){  document.getelementbyid("divy").innerhtml="    <iframe src='test.html'></iframe>"; }, 3000); </script> <body> </html> 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -