How can I trigger an image load by clicking other element rather than the image itself (Lazy Load jQuery plugin)?

Posted by janoChen on Stack Overflow See other posts from Stack Overflow or by janoChen
Published on 2010-07-15T16:05:17Z Indexed on 2011/01/09 9:53 UTC
Read the original article Hit count: 237

Filed under:
|

In the Lazy Load plugin's documentation (A jQuery plugin that loads images only when an event occurs) says:

Event can be any jQuery event such as click or mouseover. You can also use your own custom events such as sporty or foobar. Default is to wait until user scrolls down and image appears on the window. To prevent all images to load until their grey placeholder image is clicked you could do:

$("img").lazyload({ 
    placeholder : "img/grey.gif",
    event : "click"
});

In this case is clicking the image, but how can I trigger the image load by clicking other element rather than the image itself (say an anchor link/button)?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about lazyload