Le 10/14/08 6:10 PM, Santander a écrit :
both looks nice, not not too practical. The 1st sample takes a time when
load/adjust window, plus add this Vista "black background" effect,
whereas the regular javascript popup works faster - just open on click
and close on click. 2nd one show preview on mouseover. What I meant is
simple popup that opens on click on closes on click.
The second works too with onclick
(probably not with IE < 8)
You asked the best ways, no ?
They are.
Popups are most of the time badly appreciated by users.
(some browsers can be fixed to disallow them)
Today the displaying of big image in same window is the way.
(if javascript is enabled)
(if not, the big image is displayed in same window and the user has to
click the back button of is navigator to come back to the gallery)
<a href="big_image.jpg" onclick="return pop(this)">
<img src="small_image" alt="thumbnail" title="venus">
</a>
JS :
====
var IE=false; /*@cc_on IE=true; @*/
function pop(what) {
var v = document.getElementById('viewer');
v.src = what.href;
v.style.display = 'block';
if(IE) {
var top = document.body.scrollTop ||
document.documentElement.scrollTop;
v.style.top = +top +10 + 'px';
}
return false;
}
CSS :
=====
#viewer { position: fixed; top: 10px; right: 20px; padding: 10px;
background: #999; border: 5px outset gold; display: none;
cursor: pointer;
/* hack IE */ _cursor: hand; _position: absolute;
}
HTML :
======
<img src="" id="viewer" alt="" onclick="this.style.display='none';"
title"click to close me">
</body>