Trigger Events When Elements Are Viewed

jquery lazy load anything

Run Javascript or jQuery when elements come into view of the browser.


$('p').lazyloadanything({
    'onLoad': function(e, LLobj) {
        // Put your Javascript/jQuery goodness here
    }
});

Download at Github

Is this just another “lazy load” plugin for images?

No, not really. It can definitely be used to do lazy load images. In fact, the example on my Github page shows how to use it as an image lazy loader. However, this little jQuery plugin goes a little farther. Certainly there are many useful lazy loader plugins but this can be used to do anything you want when any element of your choice comes into view of the browser.

By simply using a jQuery selector you can specify any elements that come into view of the browser to trigger an event for processing. In the jQuery plugin settings there are also events for executing code before any events take place or after all events have fired. Depending on the plugin settings you can also have the event fire once or every time it comes into view.

I’m not going to go too much into all the settings and whatnot here in the blog. All of the lazy load plugin settings are available on the Github home page. Don’t worry if you don’t use Github, you can just download the code. It is a very light and easy jQuery plugin so you shouldn’t too much trouble customizing it. Please fork the project if you would like to make fixes and add enhancements. I would greatly appreciate that ๐Ÿ˜‰

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

That’s Me Ya’ll

%d bloggers like this: