某DIV是否在当前可视区域内

function isInViewport(el){
    var rect = el.getBoundingClientRect();

return (
    rect.bottom >= 0 && 
    rect.right >= 0 && 

    rect.top <= (="" window.innerheight="" ||="" document.documentelement.clientheight)="" &&="" rect.left="" <="(" window.innerwidth="" document.documentelement.clientwidth)="" );="" }="" code="">
© 404mzk all right reserved,powered by Gitbookhttp://blog.404mzk.com 该文件修订时间: 2017-10-19 22:21:39

results matching ""

    No results matching ""