Michele
Michele

Reputation: 1488

How can I slide a DIV in jQuery?

I'm looking for something in JQuery to allow a synchronized slide of a big div.

The div width can be increased runtime by other jquery functions.

I want to scroll the div horizontally, sliding 50px every second....is it possible to do this synch?

thank you all

Upvotes: 0

Views: 767

Answers (1)

Yoshi
Yoshi

Reputation: 54649

Something like this?

(function slide() {
  $('#foo').animate(
    // move 50px to the left
    {left: '-=50px'},

    // in one second
    1000,

    // without easing 
    'linear',

    // recursive call on completion
    slide
  );
}());

Upvotes: 1

Related Questions