-
-
Save shijiaoliang/76cd182cacd01ef7f1f3 to your computer and use it in GitHub Desktop.
【JS】判断元素是否在可视区域内
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = document.getElementById("eq").offsetTop; | |
if (a >= $(window).scrollTop() && a < ($(window).scrollTop()+$(window).height())) { | |
alert("div在可视范围"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment