Click here to Skip to main content
15,906,463 members
Articles / Web Development / HTML
Article

Pop open according to the size of the image

Rate me:
Please Sign up or sign in to vote.
2.12/5 (5 votes)
16 Mar 2007 28.7K   199   10   3
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


Written By
Software Developer (Senior)
India India
I am software professional in Polaris india

Comments and Discussions

 
GeneralUser Agent Detecting is From Prehistoric Ages Pin
volkan.ozcelik21-Mar-07 7:04
volkan.ozcelik21-Mar-07 7:04 
google: "object detection"
google: "unobtrusive javascript"

just my 2c if that counts.

Hope that helps.


GeneralDelete NS variable Pin
dadomingues20-Mar-07 1:31
dadomingues20-Mar-07 1:31 
Generaldoesn't work in IE 7.... Pin
Tsjaar19-Mar-07 21:31
Tsjaar19-Mar-07 21:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.