jQuery로 Scroll이 멈추는 시점에 특정 함수를 호출하도록 하는 스크립트입니다.
1 2 3 4 5 6 7 8 9 10 11 12 | $.fn.scrollStopped = function (callback) { var that = this , $ this = $(that); $ this .scroll( function (ev) { clearTimeout($ this .data( 'scrollTimeout' )); $ this .data( 'scrollTimeout' , setTimeout(callback.bind(that), 250, ev)); }); }; $(window).scrollStopped( function (ev){ console.log(ev); alert( 'scroll stopped' ); });<div></div> |
'IT > Javascript' 카테고리의 다른 글
야후 콤보 핸들러 (0) | 2017.02.12 |
---|---|
jQuery selector 정리 (0) | 2015.11.07 |
Image 로딩 확인 후 Height값 구하기 (0) | 2015.06.10 |
WRITTEN BY
- Dukejin
If you don't walk today, you will have to run tomorrow. Try hard, Try hard!
,