SageFix. LetsFix!  
Current Location : Home > Web Development > JavaScript > Open new window with only a picture in it Share/Save/Bookmark    

Main Menu
SageFix - Let's Fix

Board Categories
    Web Site Designing
- Graphics
    Web Development
- .NET
- Classic ASP
- JavaScript
- PHP
    WebSite Management
- Promotion Techniques
- Search Engine Optimization
    Databases
- MySQL

Tutorials

Database Connection Strings

  Contact Us


 1 - 9 of 9 [Total 1 Pages]  
Open new window with only a picture in it      Jul 25, 2002, 04:54 1
  
Hi,

Can anyone tell me how to open a new window with only a picture inside? The width and height of the window should fir the picture.

THanks in advance

->Daniel.

 
      Jul 25, 2002, 05:29 2
  
I'm only guessing - and not really concentrating - so let me know if it doesn't really work and we'll look at it more.

you proably want to do something like:

Code:
var newWin=window.open('url.html','Picture','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0');newWin.document.open();var nImg=new Image();nImg.src = 'img.gif';newWin.document.appendChild(nImg);newWin.document.close();newWin.resizeTo(nImg.clientWidth, nImg.clientHeight);
I don't know that clientWidth and Height will recieve the sizes correctly - you may otherwise try offset Width.
Failing that - maybe screenWidth (though i don't think that's applicable) and finally style.pixelWidth ( though i am nearly sure that has to have the css width set! )

Flawless

 
      Jul 25, 2002, 07:33 3
  
Flawless is pretty much right on the mark, but I will say this: I've tried using the resizeTo() method for this exact same purpose, and the results are less than dependable. The root of the problem is in the delay between the image FULLY loading so that the correct height/width can be used. Here's a file with the source code I used (and gave up on) If you get it to work better (or more consistently) let me know!

http://www.peterbailey.net/js/imagepopup.js

Just call the popImg() function from any event (usu. onClick) The only parameter is a string containing the img src.
Code:
<a href="javascript:popImg('images/photo.jpg')">Photo</a>-OR-<span onClick="popImg('images/photo.jpg')">Photo</span>
You can see this working(sort of) online in the Inventory section at www.autolinkdallas.com
EDIT: I just visited the Autolink site again myself, and it seems they've really screwed up their inventory system. The picture for the M3 listing works, too bad it's really a pic of a Benz :p

 
      Jul 25, 2002, 07:37 4
  
Where's your signature from - too?!?!?

And yes - resizeTo can be unpredictable.

But you'll notice i used a new Image object - which
/should/ load it faster.

Flawless

 
      Jul 25, 2002, 07:47 5
  
There's a trilogy of comedies (kind of like Horror-spoofs) starring one main character, Ash.

Evil Dead
Evil Dead 2
Army of Darkness

All REAL funny. 'This is my BOOMstick' comes from Army of Darkness, which is arguably the best (unusual for sequels, eh?) You don't really need to watch the Evil Dead's to appreciate AoD. Anyhoo, he(Ash) is transported to a more medieval time, but manages to take a shotgun along for the ride...

http://www.geocities.com/CollegePark...3/boomstic.wav

http://www.houseofhorrors.com/armyof.htm

 
      Jul 26, 2002, 02:03 6
  
Flawless, your code doesn't work. I tried it but nothing popped up and it says error on page?

Thanks

 
      Jul 26, 2002, 02:05 7
  
Yes - it probably would ... it's completely untested!

What line was the error in?

Flawless

 
      Jul 26, 2002, 06:15 8
  
In Opera 6 a new blank page popped up.

In IE 6 nothing happens. In status bar it says there are errors in page.

Thanks

 
      Jul 26, 2002, 07:27 9
  
You should install a script debugger to get more info.

Microsoft's one's good ( i think it comes with one of their
sdk's)

Flawless

 
 1 - 9 of 9 [Total 1 Pages]  









Subscribe to our mailing list
email


Current Location : Home > Web Development > JavaScript > Open new window with only a picture in it Share/Save/Bookmark    

Development problem? SageFix is completely free -- paid for by advertisers and donations. Click here to Contact Us If you have any query. Enjoy!
Request processed in 6.0E-5 seconds Home - Contact Us - Terms Of Service - Privacy Policy - Copyrights - Top
Advertisements do not imply our endorsement of that product or service.
Current server time now is 14-Mar-2010 14:03:07
Copyright © 2009 Sagefix Inc. All rights reserved.
Powered By SageFix