You are here: Re: Clip Image inside div « HTML « IT news, forums, messages
Re: Clip Image inside div

Posted by Jukka K. Korpela on 06/11/07 06:04

Scripsit MarkusJNZ@gmail.com:

> When someone does a mouseover on a thumbnail I am showing the big
> image using the following code
>
> function showImage(imageName)

I hope you have some fallback, like a link, for users who have decided (or
whose superiors have decided) to switch of JavaScript execution.

> {
> document.getElementById('largeImage').innerHTML = '<img src="./
> _listingImages/' + imageName + '" style="width:360px;height:238px;" /
>> ';
> }

Why invalid markup? There's never an acceptable reason to omit the alt
attribute.

Why do you use innerHTML instead of simply changing the value of the
element's src attribute (and possibly the alt attribute) in the code?

> My problem is that sometimes the large image can be bigger then the
> original DIV so I want to cut off the excess so to speak so that the
> large image is not bigger than the original div.

This part looks easy, though I might miss something since the answer looks
too obvious (but answers often are): add the following into your style
sheet:

#largeImage { overflow: hidden; }

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация