jQuery | jquery.lazyload 이미지 후 로딩
페이지 정보
작성자 굿스웹 작성일19-11-19 09:40 조회748회 댓글0건첨부파일
- jquery.lazyload.js (9.0K) 0회 다운로드 DATE : 2019-11-19 09:40:50
관련링크
본문
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript" src="jquery.lazyload.js"></script>
<script type="text/javascript">
$(function(){
$('img.gocoder').lazyload({
placeholder : 'loading.gif', // 로딩 이미지
threshold: 0, // 접근 ~px 이전에 로딩을 시도한다.
effectTime : 400,
effectspeed: 200,
load : function(){ // 로딩시에 이벤트
$(this).attr('alt',$(this).attr("data-original"));
}
});
});
</script>
<img data-original="img (1).jpg" class="gocoder" width="300">