Clipped image with dynamic clip change

R

RIck Measham

I pop up a window with a picture in it, however the picture can be very
large. So here's what I want to do: Pop up a mindow with the picture
clipped to the size of the window, then place a scaled version of the
picture on top of it. Thus it will look like this:

+------------------------+
| WINDOW |
+------------------------|
| |
| |
| |
| |
| +--------+ |
| | | |
| | | |
| +--------+ |
+------------------------+

Now, the scaled version will track the mouse when mouseover. I can do that.
However what I need to do is to move the clipping of the larger background
picture to display an area centered on the mouse's position in the smaller
picture.

I figure this is two absolutely placed divs. Also I might as well just load
the same picture twice rather than having two pictures to download. I'll
just scale the smaller one.

As I said I can get the smaller image's mouse position, however I can't work
out how to clip the larger image. It seems I need to mix clipping with some
sort of scrolling because clipping just adds a border!

Any help greatly appreciated
Cheers!
Rick
 
L

Lasse Reichstein Nielsen

RIck Measham said:
As I said I can get the smaller image's mouse position, however I can't work
out how to clip the larger image. It seems I need to mix clipping with some
sort of scrolling because clipping just adds a border!

Have you considered using the large picture as a background image for
a box? Then you can use the CSS background-position property to move
it around inside the box.

/L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top