I’m trying to implement the equivalent of a css property: “overflow: transparent 50%”. For example, if I have this:
<div style="border: 1px solid black; width: 200px; height: 200px; overflow: visible;">
<img src="img.png">
</div>
I’d like the part of the image displayed in the 200×200 box to be normal. The part of the image that overflows the 200×200 box I want to be partially transparent. Maybe there’s ways to do this by defining four divs on all around the main div? I’m not sure of an easy way to do this.
+------------------+
| img overflow, |
| 50% transparent |
| +------------+ |
| | normal img | |
| +------------+ |
| |
+------------------+
Image width and height is known before hand. The div will have some javascript attached to it to allow for image repositioning by dragging, so the div will act like a viewport, and the image could overflow on any side. Needs to work in all browsers, ideally.
Not sure how well browser support would be, but something like this should start you off:
Edit: forgot the JS Fiddle Link. http://jsfiddle.net/BradleyStaples/rWzng/