Recently to do a page function, you need to detect whether a page element is located in the current screen of the visual area, the first thought of course is to obtain offsetleft and offsettop, this value is compared with Body.scrolltop/scrollleft, respectively, To see if the element is visible. This time to check the information by chance to see Getboundingclientrect (); The method obtains the left, top, right, and bottom of an element in the page, respectively, relative to the position of the browser window, and he returns an object, object, which has a property: Top,left,right, Bottom: Here the top, left and CSS are very similar to the understanding, but Right,bottom and CSS in the understanding is a little different, see: http://zhouyj668.blog.163.com/blog/static/ 1125232802013230062896/
Determines whether the page element enters the viewable area