View Full Version : Lazy Load on Div

05-10-2012, 10:49 AM
Hi, i have this new project that implement Lazy Load Jquery.
But i have a lot of image, and the .gif loader make my page look like a mess.

So if i want to attach it to <div> how to make it right?

I try this:

<script type="text/javascript" charset="utf-8">
$(function() {
$("div .loading").lazyload({
effect : "fadeIn"

<div id="item2" class="item loading">
<a name="item2"></a>
<div class="content">
<img src="images/loading.gif" data-original="images/img2.jpg"><img src="images/loading.gif" data-original="images/img5.jpg">
<img src="images/loading.gif" data-original="images/img6.jpg"><img src="images/loading.gif" data-original="images/img6.jpg">
<div style="position:absolute; z-index:90;"><a href="#item3" class="panel">3</a><a href="#item1" class="panel">back</a></div></div>

but it don't work. Any suggestion?
Thank you

05-11-2012, 02:36 AM
There could also be other problems, but the meaning of this selector:

$("div .loading")

is - all elements with a class of loading that are direct or indirect descendants of a div element.

I think what you meant is:


which means - all div elements that have a class of loading.