popUp dimension...

R

riki

hi,
in one folder i've put all pics, but they are not all the same size. i've
got as many links as pics and clicking on link popUp opens showing that pic.
now, i would like to have one function that opens popUp window but in
different dimension for different pic.
i.e.
<A href="#"
onClick="javascript:window.open('/path/pic.jpg','','width=[PIC.WIDTH],height
=[PIC.HEIGHT],
toolbar=0,location=0,directories=0,menuBar=0,scrollBars=no,resizable=1');">
<STRONG>Enlarge pic</STRONG></A>

how can i get PIC.WIDTH and PIC.HEIGHT?
thanks
 
L

lallous

Hi,

check http://bugimus.com/gurus/image_popup/imagepopup.html

--
Elias
http://lgwm.org/

riki said:
hi,
in one folder i've put all pics, but they are not all the same size. i've
got as many links as pics and clicking on link popUp opens showing that pic.
now, i would like to have one function that opens popUp window but in
different dimension for different pic.
i.e.
<A href="#"
onClick="javascript:window.open('/path/pic.jpg','','width=[PIC.WIDTH],height
=[PIC.HEIGHT],
toolbar=0,location=0,directories=0,menuBar=0,scrollBars=no,resizable=1');">
<STRONG>Enlarge pic</STRONG></A>

how can i get PIC.WIDTH and PIC.HEIGHT?
thanks
 
@

@SM

riki a ecrit :
i would like to have one function that opens popUp window but in
different dimension for different pic.

<script type="text/javascript"><!--
truc=false;
function pop(larg,haut){
if(truc!=false || !truc.closed){truc.close(); truc=false;}
else
truc=window.open('','VoirIci','width='+larg+',height='+haut',resizable=1');
}
// --></script>
<a href="../path/image_1.jpg" target="VoirIci"
onclick="pop(245,123);">Image 1</a>

If JS is unactive ==> a new window will open
If JS ==> a new nake window with right dimensions will open
and the html will send the image to the target "VoiIci" wich is in the popup.

--
**************************************************************
Stéphane MORIAUX : mailto:[email protected]
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
**************************************************************
 
R

riki

<script type="text/javascript"><!--
truc=false;
function pop(larg,haut){
if(truc!=false || !truc.closed){truc.close(); truc=false;}
else
truc=window.open('','VoirIci','width='+larg+',height='+haut',resizable=1');
}
// --></script>
<a href="../path/image_1.jpg" target="VoirIci"
onclick="pop(245,123);">Image 1</a>

yes, but now i have to manualy insert width and height in the
pop(width,height) function and i would like something like this if it is
possible

onclick="pop(getImage[imgPath/imgName].getWidth,
getImage[imgPath/imgName].getHeight);">Image 1</a>

i don't know if i explained it right.
thanks.
 
@

@SM

riki a ecrit :
yes, but now i have to manualy insert width and height in the
pop(width,height) function and i would like something like this if it is
possible

onclick="pop(getImage[imgPath/imgName].getWidth,
getImage[imgPath/imgName].getHeight);">Image 1</a>

<SCRIPT LANGUAGE="JavaScript">
/*
SCRIPT EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
Ne copiez ce code qu'une fois dans votre page
Copy this code only once in your page
*/
function afficheVignette(cheminVignette,cheminMaxi)
{
document.write('<A HREF="javascript:afficheMaxi(\''+cheminMaxi+
'\')"><IMG SRC="'+cheminVignette+
'" HSPACE=0 VSPACE=0 BORDER=0 ALT="cliquez ici pour voir en grand"></A>');
}
function afficheMaxi(chemin) // chemin = path to big photo file
{
i1 = new Image;
i1.src = chemin;
html = '<HTML><HEAD><TITLE>Image</TITLE></HEAD>'+
'<BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>'+
'<CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="'+
window.resizeTo(document.imageTest.width,document.imageTest.height)">'+
'</CENTER></BODY></HTML>';
popupImage = window.open('','_blank','menuBar=0,scrollbars=0,resizable=1');
popupImage.document.open();
popupImage.document.write(html);
popupImage.document.close()
};
</SCRIPT>

To use this script :
insert in your page each time there where you need an image "zoommable"
<p><SCRIPT LANGUAGE="JavaScript">
affiche('path_thumbnails/Img1.jpg','path_tall_Photos/Img1.jpg');
</script>
<p><SCRIPT LANGUAGE="JavaScript">
affiche('path_thumbnails/Img2.jpg','path_tall_Photos/Img2.jpg');
</script>

could be replaced by :
<A HREF="javascript:afficheMaxi('path_big_Photos/Img1.jpg');
"><IMG SRC="path_thumbnails/Img1.jpg" HSPACE=0 VSPACE=0 BORDER=0
ALT="Clicable picture" TITLE="Click me to see me in tall"></A>
<A HREF="javascript:afficheMaxi('path_big_Photos/Img2.jpg');
"><IMG SRC="path_thumbnails/Img2.jpg" HSPACE=0 VSPACE=0 BORDER=0
ALT="Clicable picture" TITLE="Click me to see me in big"></A>

You probably will have to adapte to be compatible with DOM

--
**************************************************************
Stéphane MORIAUX : mailto:[email protected]
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephanePOINTmoriaux/internet/
**************************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top