javascript - Issue creating side-by-side slideshows with jQuery -
i'm trying create site 2 slideshows. i've tweaked , re-tweaked js , jquery numerous times. 1 slideshow works , other cycles between 1 picture, other times both work out of sync, or fadein doesn't seem applied second slideshow, or in variations 1 slideshow stays frozen on initial image , remains static. anyway, created js fiddle (link @ bottom) , apparently code @ least free of typos. js below, rest on js fiddle. appreciated.
$(document).ready(function () { $(".slider #1").fadein(1000); $(".slider #1").delay(2000).fadeout(1000); var sc = $(".slider img").size(); var count = 2; setinterval(function () { $(".slider #" + count).fadein(1000); $(".slider #" + count).delay(2000).fadeout(1000); if (count === sc) { count = 1; } else { count++; } }, 3500); $(".slidertwo #7").fadein(1000); $(".slidertwo #7").delay(2000).fadeout(1000); var sc2 = 12; var count2 = 7; setinterval(function () { $(".slidertwo #" + count2).fadein(1000); $(".slidertwo #" + count2).delay(2000).fadeout(1000); if (count2 === sc2) { count2 = 7; } else { count2++; } }, 3500); });
first:- never write id numbers. try $(window).load
because document.ready
work once basic html generated, however, window.load work when resources loaded html images etc... i've seen on js fiddle it's working fine. i've done closed <img>
tags due html starts working. removed document.ready
code , set onload in left panel of jsfiddle
selected jquery 1.8.3 in left panel
Comments
Post a Comment