30+ small images, layered on top of eachother... old photos, in chronological order, starting from the earliest:earliest photo has highest z-index.
With jQuery, 2 functions are bound to each image: click, the image enlarges and is draggable; doubleclick, it fades out.
Watching people try it, they like keeping the screen full of images-- 5-6 take up most of the screen space, and they like the way images slide around under eachother.
But: what's really wanted is a way to make the latest enlarged image the topmost layer, rather than the bottom-most... apart from individually assigning z-indexes in 30+ individual functions.
Suggestions very welcome: my vocab is pretty limited, this looks like an opportunity, as they say.
I am not sure to understand the question. With 30 z-indexes, one function is enough to determine the z-index min or max and to attribute its value (more or less one) to the latest enlarged image...
Photo1 is z-index:50;
photo2 starts as z:49, and needs to be z:51 when enlarged;
photo3 starts as z:48 and needs to be z:52 when enlarged;
photo4 starts as z:47 and need to go to z:53 ...etc.
The increase in z-index needs to be incremental.
I'm not sure how to make this happen in one function.
I did think of starting with the z-indexes going from 0 to -1, -2,-3 etc, and finding a way to change them to positive: but haven't tried it yet.
It is not even necessary to recalculate the zMax !
Define one variables zMax with the initial max value and increment its value before affecting it to the enlarged images
Code:
var zMax=50;
//...
// Then in the function to enlarge the image
Object.style.zIndex=++zMax;
// Or with jQuery something like
$(... ).css('z-index',++zMax);
Been playing with 007Julien's solution, and can bind the function to a mousdown to go with the enlarging, and with a click to bring the image to the top, from wherever.
But I'm going to suss out your way of doubledealing with the img tag, I think it's got possibilities.
Bookmarks