开发者

How can I get jQuery to call an event handler when an image actually appears on-screen?

开发者 https://www.devze.com 2022-12-16 20:26 出处:网络
How can I use jQuery to trigger a callback of a JavaScript function when I scroll down and see a pict开发者_如何学编程ure? I wish to delay loading certain images until they actually appear on-screen..

How can I use jQuery to trigger a callback of a JavaScript function when I scroll down and see a pict开发者_如何学编程ure? I wish to delay loading certain images until they actually appear on-screen... Ideally, I'd be able to do something like:

$('#img#').look_on() { ...

So no images are loaded apart from those I have seen.


I think this JQuery Event Plugin does what you need:

Element 'in view' Event Plugin

I've created an event that will trigger when the element is scrolled in to the viewport.

also, the LazyLoad Plugin seems to have a "viewport" selector for JQuqery: Here.


Here is some kind like what i searched for... http://www.appelsiini.net/projects/lazyload

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号