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 .

slider 1860px wide, but only 620 pixels displayed at once (as parents code: overflow: hidden < / Code is>) after about a 6-second delay,

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

  • after another 6 seconds, then I want to:

    1. Remove slideLeft620 and remove slideLeft1240 from to slider
    2. 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

    < Pre> setTimeout (function () {$ ("#slider"). AddClass ("slideLeft620");}, 100);

    Comments

    Popular posts from this blog

    java - org.apache.http.ProtocolException: Target host is not specified -

    java - Gradle dependencies: compile project by relative path -

    ruby on rails - Object doesn't support #inspect when used with .include -