JS determines whether the page in the IFrame scrolls to the bottom triggering event

Source: Internet
Author: User

This article mainly introduces JS to determine whether the Web page in the IFRAME scroll to the bottom trigger event, the need for friends can refer to the

There is a need to determine whether the Web page in the IFRAME scroll to the bottom of the trigger event, the Internet to find a lot of information is said under the current page, simply on their own research, found a solution. ClientHeight: The height of this element, taking up the height of the entire space offsetheight: refers to the height of the content of the element scrolltop: You can understand the length of the scroll bar can be scrolled below is the source code code as follows: <iframe src= "~/  Files/3.html "id=" Iframepage "width=" 825 "onload=" func () "></iframe> <script type=" Text/javascript ">  function func () {var IFM = document.getElementById ("Iframepage");  Ifm.height = window.document.body.clientheight-100; <!--in chrome with compatibility issues, FF and IE10 no problem, online said chrome access to the IFRAME in the server environment, do not know what situation--> window.document.getElementById (" Iframepage "). Contentwindow.onscroll = function aaa () {var IFM = document.getElementById (" Iframepage ").  ContentWindow.document.documentElement;  if (ifm.scrolltop = = ifm.scrollheight-ifm.clientheight) {alert ("in the End"); }} </script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.