Qarib Haider
Qarib Haider

Reputation: 4906

Slide in jQuery

I am new to jQuery. I have learned functions like SlideUp and Down but I can't find anything like Slide Left and Right.

I want to make a content slide with horizontal sliding effects. I have achieved vertical sliding in it. I dont want to use an existing plugin or library. I want to build my own.

Please guide me !

Upvotes: 0

Views: 13294

Answers (4)

Vivek
Vivek

Reputation: 11028

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

Upvotes: 2

Dutchie432
Dutchie432

Reputation: 29170

Here is an example using animate(). This can easily be adpoted to be a jQuery function rather than JS functions

$('#slidein').click(function(){
    $('div').stop().animate({
        'width':'500px'
    }, 500);
});

$('#slideout').click(function(){
    $('div').stop().animate({
        'width':'0px'
    }, 500);
});

Upvotes: 2

Hung Tran
Hung Tran

Reputation: 1645

Maybe JCycle can be suitable for you. It supports a lot of changing slide such as up, down, left, right, fade in/out, ....

You can download and view demo at this website : http://jquery.malsup.com/cycle/

Upvotes: 1

Arj
Arj

Reputation: 2046

You should be able to use the animate() function as described here to adjust the width property of the element you want to animate.

There are a number of examples on that page so you should be able to play with what's there to achieve your desired effect.

Upvotes: 1

Related Questions