diff --git a/jquery.fullPage.js b/jquery.fullPage.js index 17186e0ab..57479825c 100755 --- a/jquery.fullPage.js +++ b/jquery.fullPage.js @@ -103,6 +103,7 @@ slidesNavigation: false, slidesNavPosition: 'bottom', scrollBar: false, + lazyDistance: 1, //scrolling css3: true, @@ -1348,6 +1349,25 @@ var slide = destiny.find(SLIDE_ACTIVE_SEL); if( slide.length ) { destiny = $(slide); + + if( destiny.length == 1 && destiny.filter(SLIDE_SEL).length ) { + // Handling a single slide. + if( options.lazyDistance ) { + var prev = destiny.prevAll(':lt('+options.lazyDistance+')'); + var next = destiny.nextAll(':lt('+options.lazyDistance+')'); + + // Add first/last sibling when there's no next/prev. + // (does not use options.lazyDistance currently). + if (options.loopHorizontal ) { + if(!next.length) { + next = destiny.siblings(':first'); + } else if(!prev.length) { + prev = destiny.siblings(':last'); + } + } + destiny = destiny.add(prev).add(next); + } + } destiny.find('img[data-src], video[data-src], audio[data-src]').each(function(){ $(this).attr('src', $(this).data('src'));