Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / HTML

Pop open according to the size of the image

2.12/5 (5 votes)
16 Mar 2007 1   200  
Pop open according to the size of the image: Put images in the folder & give the name & path of the images & folder
Screenshot - ImagePopUp.jpg

Introduction

Article will open pop up according to the size of the image automatically

Background

Background to this article that I was working some client work where i have to open my popup according to the sizeof the image Which is on the client side.

Using the code

For Using this article user has to download the zip & unzip any where on the disc. Double click on the abc.htm & click on images link.

Blocks of code should be set as style "Formatted" like this:

//Code
// <script language="Javascript">
   function PopupPic(sPicURL) {
     window.open( "popup.htm?"+sPicURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200");
   }
   </script>
 <script language='javascript'>
   var arrTemp=self.location.href.split("?");
   var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
   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();
     };
 </script>
//

Points of Interest

Interesting point to be consider that java Script can do what ever we need on web.

History

I was working some client work where i have to open my popup according to the sizeof the image Which is on the client side.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here