I am using a horizontal image viewer with lazyload.js and mCustomScrollbar
I can get it to work however I do not think my code is sound and there is a lag when the pages loads before I can click, drag or scroll the slider.
This post was very helpful, but not 100% there. I believe every time I scroll the page the code is being re outputted?
I am using the following code for the lazy load:
<script>
jQuery(function() {
jQuery("img.lazy").lazyload({
container: jQuery("#slider"),
skip_invisible : false,
});
jQuery(window).resize();
});
jQuery(window).load(function() {
jQuery(window).resize();
});
</script>
and this is the code for the custom scrollbar
<script>
(function($){
$(window).load(function(){
$("#slider").mCustomScrollbar({
axis:"x",
scrollButtons:{
enable:true
},
scrollButtons:{ enable: true },
autoDraggerLength: false,
theme:"dark-thin",
mouseWheel:{ preventDefault: true },
mouseWheel:{ invert: true},
callbacks:{
whileScrolling:function(){ WhileScrolling(); }
}
});
function WhileScrolling(){
$("img.lazy").lazyload();
}
});
})(jQuery);
</script>
Any input would be greatly appreciated.