By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

popUp dimension...

P: n/a
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,scrol lBars=no,resizable=1');">
<STRONG>Enlarge pic</STRONG></A>

how can i get PIC.WIDTH and PIC.HEIGHT?
thanks
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

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

--
Elias
http://lgwm.org/

"riki" <ri******@hotmail.com> wrote in message
news:br**********@ls219.htnet.hr...
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,scrol lBars=no,resizable=1');"> <STRONG>Enlarge pic</STRONG></A>

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

Jul 20 '05 #2

P: n/a
@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+',heig ht='+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:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************
Jul 20 '05 #3

P: n/a
<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+',heig ht='+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.


Jul 20 '05 #4

P: n/a
@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,re sizable=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:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephanePOINTmoriaux/internet/
************************************************** ************
Jul 20 '05 #5

P: n/a
thank you very much
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.