i am very new to javascript, am not in school, nor do i do this on a job, so my understanding is limited to say the least. I have been using plugins and altering examples i find online to accomplish my goals. i did look for a similar question, but they all point to changing source or playing the video, which is not the problem.
I have a video gallery document which uses mini versions of the video as previews, not images. problem is, with over seven hundred of them on one document, the computer coughs up a lung and dies if all the videos are preloaded. my solution so far is as follows.
first, i installed a lazyloading plugin called b-lazy, which stutters after a few of them are displayed in firefox, and stops displaying them.
the first script plays the video thumbnail when you hover over it.
$(window).load(function(){
$(document).ready(function() {
$('.b-lazy').each(function(i, obj) {
$(this).on("mouseover", function() { hoverVideo(i); });
$(this).on("mouseout", function() { hideVideo(i); });
});
});
function hoverVideo(i) {
$('.b-lazy')[i].play();
}
function hideVideo(i) {
$('.b-lazy')[i].pause();
}
});
the second script divides the video thumbnails into sections, and displays these sections one at a time when the show more button is clicked.
$(window).load(function(){
$(document).ready(function () {
shazam = $("#vidlist .divider").size();
x=0;
$('#vidlist .divider:lt('+x+')').show();
$('#loadMore').click(function () {
x= (x+1 <= shazam) ? x+1 : shazam;
$('#vidlist .divider:lt('+x+')').show();
});
});
});
now this does work if i set all the video thumbnails to preload=none, but then the thumbnail doesn't show up unless you hover the mouse over it first. i want to display 24 of these at a time, and change the preload state from none to auto when visible. is this crazy? i am such a rookie that i don't even know how to ask the question intelligently. please help...