javascript - Delay method to add class to div -
I'm trying to create a type of "slider" I have 9 items in a row, which is a
slider
1860px wide, but only 620 pixels displayed at once (as parents
in one position to reveal my 3 objects at a time, along with the slider
Want to make changes Then it should be changed again after another 6 seconds, then it will have to return.
So I have created two squares:
.slideLeft620 {left: -620px; } .slideLeft1240 {left: -1240px; }
Animation between the standard (without this left
value) I hope the content will appear as "Slide".
After 6 seconds, add the class slideLeft620
to slider
- Remove
slideLeft620
and removeslideLeft1240 from
toslider
- and Then after 6 seconds, class
slideLeft1240
This is what I tried to get started (just doing this number 1 at the moment). But I can not work it
$ ("#slider") addClass ("slideLeft620") delay (100) ..
(I know that there is a random value at 100 mo).
Any idea why this will not work? Should delays call .addClass after a few moments?
EDIT: Suggestions for calling. The first drawer does not work:
$ ("# slider") .delay (100) .addClass ("slideLeft620");
delay ()
works only on jQuery methods That connects to the Fx queue, and it's basically just animation methods, it does not work for addClass
, you can use one time instead
setTimeout (function () {$ ("#slider"). AddClass ("slideLeft620");}, 100);
Comments
Post a Comment