I spent all yesterday working on this - in my case it was for text, not an image, but I don't see how they could be different. It was harder to work out the idea than I thought, because there were problems like keeping the hidden div open and making it reliable as to cursor position. What finally worked was this:
- Code: Select all
div#links a span {display:none; }
div#links a:visited span{display: none;}
div#links a:hover span{display: block; width:auto; height: auto; font-size: 12pt/14pt; z-index: 2; padding: 0 2px 2px 10px; margin-left: -10px;}
div#links a:active span{display: block; width:auto; height: auto; font-size: 12pt/14pt; z-index: 2; padding: 2px; margin-top: 5px; border: thin solid #393;}
- Code: Select all
<!--2-->
<div class="news_text" id="links"><span class="headnews"><a href="placeholder.html">Potential Medical Breakthroughs Hindered by Deforestation in Borneo</a></span>
<a http=""><img src="images/arrow1.gif" width="16" height="16" alt="full article link" id="imgl" border="0"><p> Plants that promise to treat or cure cancer, AIDS and malaria have recently been discovered in the rainforests of Borneo. But the Swiss-based World Wildlife Federation has issued a statement that these trees and shrubs are in danger of destruction from the area's rapid deforestation.</p>
<span><p>The rapid destruction of trees, much of it by illegal logging to meet growing world demand for timber, could wreck any chance of using these discoveries in the fight against disease, the WWF declared.</p>
<p>A promising anti-cancer substance has been found in a Borneo shrub by researchers for an Australian pharmaceutical firm, while a chemical found in latex produced by a tree appears to be effective against the replication of HIV, the report said. In the bark of another species of tree, the researchers discovered a previously unknown substance which in laboratory tests appeared to kill the human malaria parasite, it added. In all, it said, 422 new plant species had been discovered in Borneo -- shared by Malaysia, Indonesia and Brunei -- in the last 25 years and many others were believed to be there which could have medicinal applications.</p>
<p>But "all these promising discoveries could eventually be lost if the disappearing rainforests of the heart of Borneo are not adequately protected," the WWF said. "More forest destruction could well deny science the opportunity to discover and develop further potential sources of life-saving medication," it quoted Murray Tait, vice president of Drug Delivery at Cerylid Biosciences, the Australian company that identified the anti-cancer compound, as saying.</p>
<p>Borneo's forest cover has shrunk to 50 percent of its territory today from 75 percent in the mid-1980s, the report said.</p>
</span></a>
</div>
The "active" command is pretty much irrelevant. (I might do some more work to see it I can make it stay open with a click, which I tried to accomplish but didn't get finished.)
Sorry the code is still quite dirty because it's still in progress. The important parts are the
html, the first three attribution lines before the brackets in the
css, and the first style in the
css.
You could use visibility: instead of display: if you wanted to leave white space, but it's hard to see why you'd want to. Well, maybe if you wanted to link a group of thumbnails and have the area for the large photo predefined. I don't think that would be hard to do, just a matter of tinkering with position.
It works like a charm and looks pixel-perfect. In fact I'll go ahead and get on the
FTP when I post this so you can see it in action -- hopefully it will work the same online as it does on my computer.
http://www.dhreport.com/
I found that putting a simple little colored arrow (short enough to fit in the line-height) in the top left corner of the link makes a very user-friendly target.
Here are my remaining problems, if anyone can help:
1) The cursor has to stay in the text, which is mostly not a problem, except that you can't use the scroll bar and keep the full text open at the same time.
2) I have a three-column fixed layout. The text is in the right-hand column. I can widen the hidden text outside the column easy enough, but if I expand it to the left, the other columns cover it. I've tried adding various positioning statements and using the z-index, but to no effect.
3) If anyone has a suggestion for why I can't get the italic "Note:" to change color, I'd appreciate it.