Mike
Mike

Reputation: 49

Jquery slide from right to left

I have the follow code:

$("#headerimg" + currentContainer).slideUp(function() {
  setTimeout(function() {
    $("#headertxt").slideUp(100).css({"display" : "block"});
    animating = false;
  }, 500);
});

Now the pictures animate from bottom to top. But i want that the picture, slide from right to left. What in the code i must change?

Upvotes: 2

Views: 6933

Answers (2)

jAndy
jAndy

Reputation: 235962

There is no build-in method like "slideLeft" in jQuery. So you either have to write a little plugin like

$.fn.slideLeft = function(speed){
     return this.each(function(){
        var $this = $(this);
        $this.animate({'width': '0px'}, jQuery.fx.speeds[speed] || 200);
     });
};

or you have to look for an already existing plugin out there.

Upvotes: 1

gblazex
gblazex

Reputation: 50111

Here is a great tutorial to slide elements in different directions.

from jQuery - slide right to left?

Upvotes: 3

Related Questions