0

here is the jsfiddle of my slider http://jsfiddle.net/jdDYQ/7/ All the images are loaded at once I only want to load the visible one for that I will need to know if they are visible or not. Does anyone know how to do it ?

Thanks.

<div class="wrapper" style="width:288px;overflow:hidden">
 <ul class="ui" style="width:3000px">
 <li><img class='lazy_1' src="image.png" alt="" class=""/></li>
 <li><img class='lazy_2' src="image.png" alt="" class=""/></li>
 <li><img class='lazy_4' src="image.png" alt="" class=""/></li>
 <li><img class='lazy_5' src="image.png" alt="" class=""/></li>
 <li><img class='lazy_6' src="image.png" alt="" class=""/></li>
</ul>

stephan lemaitre
  • 85
  • 1
  • 1
  • 9
  • probably [this](http://stackoverflow.com/questions/5424055/check-if-images-are-loaded) can help, or do you mean: visible and do not brocken? – Sergey Jul 17 '14 at 22:45

2 Answers2

0

The following returns true if selected element is visible and false otherwise:

if ($(selector).is(':visible')) {
  //Do something
}
Edward
  • 1,914
  • 13
  • 26
0

btw, you have two class="" inside each element.

you can check if element is visible by

$('#some_id').is(":visible")
doniyor
  • 36,596
  • 57
  • 175
  • 260
  • Yes ok I can do that, but first I have to load only visible image of the slider for the perfomances and then load once they are visible – stephan lemaitre Jul 22 '14 at 06:38