Jump to content

gallery image in a slider


pemula

Recommended Posts

look up for carousel, you'll find plenty of example code for image sliders.

 

 

i can explain you the basic idea:

 

1) put your images in an unordered list

<ul>
<li>image1</li>
<li>image2</li>
</ul>

2) float your images with a certain size in a div

3) make 2 js functions:

slideRight(), slideLeft().

 

in those functions: get the width of a li and the left indent of your ul. Use this width of a li item to set a new left-indent (this is the sliding effect) e.g.

$('#carousel_ul').animate({'left' : left_indent,queue:false, duration:500})

use a callback function on this animate function to switch the first li to the last position in case you slide to the left and set the left-indent back to the default indent. (that's how you go throught all the images).

 

4) then your need to define your triggers to slide to the left or right, triggering those js slideRight() or slideLeft() functions (e.g. clicking on arrows images or pushing your arrows keys)

 

I can imagine that without code it might seem abstract, but ill suggest you'll try something and then ill be willign to help you further.

Edited by stijn0713
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.