65.9K
CodeProject is changing. Read more.
Home

Pop open according to the size of the image

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.12/5 (5 votes)

Mar 17, 2007

viewsIcon

28868

downloadIcon

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.