- $(function(){
- $(document).scroll(function(){
- var scrollTop = parseInt($(document).scrollTop());
- $('img').each(function(i){
- var imgTop = parseInt($('img').eq(i).offset().top);
- if(imgTop>=scrollTop+300){
- $('img').eq(i).attr('src',$('img').eq(i).attr('_src'));
- }
- })
- });
- })
- //该片段来自于http://www.codesnippet.cn/detail/0112201411115.html
来源: http://www.codesnippet.cn/detail/0112201411115.html