Jump to content
Sign in to follow this  
RAZZ

Is this possible?

Recommended Posts

Hi,First cosider this code:

<div style="height: 200px; width: 200px;"><img Id="anImage" src="image.jpg"/></div>

So let's say I move the image around with java script or something.Is it possible to only make the image show if it is inside the boudaries of the div?I mean, so I will only see half the image, if I move it half way out of the div?Thank you in advance.

Share this post


Link to post
Share on other sites

Yes i think so, you could have divs at the boundry with a higher z-index than the image so if the image went into there boundry the image would disapear beneth them.Maybe there are other ways but that sprung to mind :)

Share this post


Link to post
Share on other sites

Hmm, yes. I have actually done that before. I guess I am hoping for a "cleaner" solution.Something like "showPixelsOutOfParent=no", or something.You get my drift :)

Share this post


Link to post
Share on other sites

I don't think it'd be that simple. To move the picture around with javascript I think you would have to make the image positioned absolute, and so it would jump out of parent area anyway, unless you just so happen to position it above the parenting div.

Share this post


Link to post
Share on other sites

Ok, then. I guess I will just have to hack my way out of it, using Scott's method. Perhaps swap images in certain situations.Thanks anyways guys!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...