jquery - Loading multiple slideshows one at a time -
i have used wordpress slideshow plugin called cyclone slider. have built website 1 page only, pages along slideshows stacked display: none
, visibility: hidden
, on click z-index
, visibility: visible
, display: block
.
the site loads extremely slow there lot of slideshows images averaging 100kb in size, photographers website , not want optimize images anymore.
how use jquery
load images on every slideshow once parent goes display: none
display: block
or visibility: hidden
visible. or using z-index
.
the best option if click on category, starts loading catagory or section slideshow , stops loading slideshow on.
some layout code:
<div id="togglelinks" class="gallery-toggle"> <ul> <li class="people"><a class="switch" href="#" data-toggle="#people"><i>people</i></a></li> <li class="business"><a class="switch" href="#" data-toggle="#business"><i>people</i></a></li> <li class="school"><a class="switch" href="#" data-toggle="#school"><i>people</i></a></li> </ul> </div> <div class="container"> <div class="catagories"> <div class="people cat-main"> <div id="people" class="landing-cat" style="display:block; visibility:visible;"> <div class="slider"><?php if( function_exists('cyclone_slider') ) cyclone_slider('people'); ?></div> </div> <div id="business" class="sub-cata hide" style="display:none; visibility:hidden;"> <div class="slider"><?php if( function_exists('cyclone_slider') ) cyclone_slider('business'); ?></div> </div> <div id="school" class="sub-cata hide" style="display:none; visibility:hidden;"> <div class="slider"><?php if( function_exists('cyclone_slider') ) cyclone_slider('school'); ?></div> </div> </div> </div> </div>
one option use jquery lazyload plugin.
another, more hands-on approach along lines of:
- on first load, create tags images. loaded images provide src attribute, later-loaded images provide src in different attribute.
- bind event viewing image (scroll \ click)
- when event fires, find next image, alternative src attribute , plug src attribute.
Comments
Post a Comment