I’m trying to develop a slide gallery with image tooltips according to this design:

What I need to develop is a slider controlled by two buttons, each time a button is pressed the slider’s content must move a width of the slider or the width of the content left on that side, whichever is smaller. Upon mouse entering an image inside the slider the full-size version must be displayed as a tooltip.
Here’s a fiddle of my solution so far, the problem I’m having is that images that don’t fully fit into view plus the hidden area to the left get moved to a new line. You can see the problem by clicking the
“Show content size” button, the width of the content element will be equal to the width of the container element + content element’s margin-left.
Bonus points if you can suggest an algorithm for moving the content to the right, I’ve got left figured out to a T (or so I think, anyway), but right is going to take a little more work (it doesn’t check whether the end of the content has been reached). Update: It seems I can’t implement proper movement to the right until the other issue is resolved, here’s the algorithm I came up with, I can’t measure “left to display” if I can’t measure the actual width of the content element.

I created something you might like:
gallery demo
beKindvariable. Adjust it as you like.jQ:
And the tooltip script:
HTML
(Place the
#tooltipdiv after thebodytag)CSS:
Hope you’ll like it, and you learned some useful UI design tricks.
By the way, if you want to populate your
ALTattributes (Search engines like it!) you can also grab that text and make it appear inside the tooltip like here!:demo with text inside the tooltip
Happy coding.