标签:attr height each box gif class javascrip rip 延迟
<script type="text/javascript">
$(function(){
$(window).scroll(function(event) {
var ah=$(window).scrollTop();
var ch=$(window).height()
$(‘.img_box‘).each(function(){
var bh=$(this).offset().top;
if(ch+ah-200>bh){
var a=$(this).find(‘img‘).attr("load_src");
$(this).find(‘img‘).attr("src",a);
}
})
});
})
</script>
<div class="img_box">
<img src="img/load.gif" load_src="img/img1.png">
</div>
<div class="img_box">
<img src="img/load.gif" load_src="img/img2.png">
</div>
标签:attr height each box gif class javascrip rip 延迟
原文地址:https://www.cnblogs.com/tjb0808/p/9328048.html