SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
-
Jul 25, 2002, 03:54 #1
- Join Date
- Jul 2002
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Open new window with only a picture in it
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, 04:29 #2
- Join Date
- Feb 2002
- Location
- Gatwick, UK
- Posts
- 1,206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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);
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---=| If you're going to buy a pet - get a Shetland Giraffe |=---
-
Jul 25, 2002, 06:33 #3
- Join Date
- Jul 2002
- Location
- Dallas, TX
- Posts
- 2,900
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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>
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, 06:37 #4
- Join Date
- Feb 2002
- Location
- Gatwick, UK
- Posts
- 1,206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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---=| If you're going to buy a pet - get a Shetland Giraffe |=---
-
Jul 25, 2002, 06:47 #5
- Join Date
- Jul 2002
- Location
- Dallas, TX
- Posts
- 2,900
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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, 01:03 #6
- Join Date
- Jul 2002
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Flawless, your code doesn't work. I tried it but nothing popped up and it says error on page?
Thanks
-
Jul 26, 2002, 01:05 #7
- Join Date
- Feb 2002
- Location
- Gatwick, UK
- Posts
- 1,206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yes - it probably would ... it's completely untested!
What line was the error in?
Flawless---=| If you're going to buy a pet - get a Shetland Giraffe |=---
-
Jul 26, 2002, 05:15 #8
- Join Date
- Jul 2002
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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, 06:27 #9
- Join Date
- Feb 2002
- Location
- Gatwick, UK
- Posts
- 1,206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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---=| If you're going to buy a pet - get a Shetland Giraffe |=---
Bookmarks