Javascript: how to resize a frame?

How to use javascript to resize a frame inside a frameset?

I found jQuery slideUp ( http://api.jquery.com/slideUp/ ) a very useful function, however it cannot be implemented to work with a frame.

+8
javascript jquery
source share
1 answer

To resize the frame, you will have to change the rows / cols attribute for the parent frame element.

A brief example:

<html> <head> <script> window.onload=function() { var frame=window.frames[0]; frame.document.open(); frame.document.write('<input type="button" \ onclick="parent.fx()" \ value="resize this frame to 150px height">'); frame.document.close(); } var i=50; function fx() { timer=setInterval( function() { if(i>150) { clearTimeout(timer); } else { document.getElementsByTagName('frameset')[0] .setAttribute('rows',(i++)+',*'); } } ,20) } </script> </head> <frameset rows="50,*"> <frame src="about:blank"/> <frame src="about:blank"/> </frameset> </html> 
+10
source share

Source: https://habr.com/ru/post/650182/


All Articles