These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:10 pm Advanced search

HTML 5: how to make stackable images?

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

HTML 5: how to make stackable images?

Postby bobafett » Sun May 23, 2010 2:21 am

Is it possible to load up 10 images (same dimension), stack them on top of one another only showing 1 image at a time and then by holding down the left mouse button and dragging the mouse up you scroll in one direction and moving the mouse down scrolls in the opposite direction?'

if so how can this be done? canvas element would be the begining, no?
bobafett
<h6>
 
Posts: 1
Joined: Sun May 23, 2010 2:19 am

Re: HTML 5: how to make stackable images?

Postby zcorpan » Thu Mar 31, 2011 7:35 pm

You don't need canvas for this, just position the images on top of each other, then listen for relevant mouse events and compare start position with end position to decide whether to show the next or the previous image (use z-index to change which image is shown). If you want the image to follow the mouse while dragging, you can either change its position to match the mouse cursor or make the element draggable with the drag and drop stuff. You can also make it animate nicely on drop with CSS transitions.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest