26. februar 2005 - 20:01
Der er
5 kommentarer og
1 løsning
Tilpas popup-vindue billedets størrelse.
Jeg bruger pt. nedenstående kode til at åbne billeder fra et galleri i:
function popup(url, height, width) {
var positionY = (screen.height - height) / 2;
var positionX = (screen.width - width) / 2;
window.open(url,'popup','height=' + height + ',width=' + width + ',left=' + positionX + ',top=' + positionY + ',location=no,menubar=no,resizable=no,status=no,toolbar=no');
}
Er det muligt, at ændre denne kode, således at vinduet automatisk tilpasser sig billedet størrelse?
26. februar 2005 - 20:03
#1
ircimages.com bruger denne her:
<script language='javascript'>
var NS = (navigator.appName=="Netscape")?true:false;
function FitPic() {
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight;
iWidth = document.images[0].width - iWidth;
iHeight = document.images[0].height - iHeight;
window.resizeBy(iWidth, iHeight);
self.focus();
document.getElementById('pleasewait').style.visibility = 'hidden';
};
</script>
<BODY onload='FitPic();'>