How to Control embedded iframe scrolling in pages? The method is to use the scroll method of iframewindow. You can refer to the following example to control embedded iframe Scrolling on the page? The method is to use the scroll method of iframe window:
1. Get the window object of iframe
Var iwin = document. getElementById ('iframe1'). contentWindow;
2. Get the window document Object of iframe
Var doc = iwin.doc ument;
3. Call the scroll method of the iframe window object
Iwin. scroll (0, doc. body. scrollHeight );
Scroll has two parameters: x and Y-axis.
Doc. body. scrollHeight is the height of the iframe page (including undisplayed parts)
An example of a comprehensive application is as follows:
The Code is as follows:
Hover test
Html code
- Chapter 1In which a dragon is seen
- Chapter 1In which a knight is summoned
- Chapter 1In which a proncess is disappointed
- Chapter 1In which a dragon is seen
- Chapter 1In which a dragon is seen
- Chapter 1In which a dragon is seen
- Chapter 1In which a dragon is seen