javascript - jQuery fadein/out -


I have a div with several images, I only need to display 6 at a time. Then I should fade in the next six in the list and fade in the next 6.

I wrapped it in the setInterval function. Is it possible?

So far, I've found:

  var hiddenElements = $ ('. Logo div.logo: gt (5)'); HiddenElements.hide (); Set interval (function () {// รข ?? |}, 2000);   

"Logo" is the class of div s which needs to be faded. They have all CSS background images (hence there is no img tag.)

< P> This is a very straightforward approach, just for fun. But you should customize your html. Wrap every 6 images in a container and then toggle them - it will be more clean and nature solution.

Sketch:

  & lt; Div class = 'hidden' & gt; 1 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 2 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 3 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 4 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 5 & ​​lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 6 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 7 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 8 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 9 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 10 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 11 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 12 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 13 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 14 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 15 & lt; / Div & gt; & Lt; Div class = 'hidden' & gt; 16 & lt; / Div & gt; & Lt; Script & gt; $ (Function () {fadeByEachSlice ("hidden", 6)}) Function Feeds (object, phase) {var i = 0; Objects = $ (object) function nextSlice () {if (i% phase == 0) {if (i & lt; = objects.length) {slice = objects.slice (i, phase + i); Feedslace (piece)}} Function Feedslice (piece) {$ (piece). Fadein (). Delay (1000) .Fedaut ("fast", function () {i + = 1; next slice (;;}}}) Next slice ()} & lt; / Script & gt;    

Comments