Pop-up enlarged image viewer
Discussion
Does anyone have a bit of ASP code (has to be ASP, can't get my head around PHP) that will automatically resize a browser window to fit the image that is currently displayed in it?
I want to use it for pop-up full-size images that vary slightly in size from time to time.
Cheers all...
I want to use it for pop-up full-size images that vary slightly in size from time to time.
Cheers all...
One thing about the web is that it's easy to steal other people's ideas:
www.tvrcc-northants.co.uk/scripts/nav.js
In javascript, at least. Server side technologies such as PHP and ASP can be trickier.
www.tvrcc-northants.co.uk/scripts/nav.js
In javascript, at least. Server side technologies such as PHP and ASP can be trickier.
miniman said:
Yup! All I need is the ResizeToImg code!!
Can do it with Javascript:
function resizeToImg(img) {
imgWidth = img.width;
imgHeight = img.height;
self.resizeTo(imgWidth,imgHeight);
self.moveTo((self.screen.width-imgWidth)/2,(self.screen.height-imgHeight)/2);
}
Simply call it OnLoad in the img tag
<img src="piccy.jpg" onLoad="resizeToImg(this);">
steve-p said:
One thing about the web is that it's easy to steal other people's ideas:
<a href="http://www.tvrcc-northants.co.uk/scripts/nav.js">www.tvrcc-northants.co.uk/scripts/nav.js</a>
In javascript, at least. Server side technologies such as PHP and ASP can be trickier.
Oh yes, it's great because you always have examples that you or other people wrote to refer back to, an online box of tricks if you will.!
Steve
>> Edited by fatsteve on Thursday 13th May 13:18
miniman said:
Thanks guys, that's great. So how do I get rid of the toolbars / status bar etc???
You do it in the window.open call, hence
function showImage(p_imageURL) {
x = window.open(p_imageURL,"windowName","toolbar=no");
}
<a href="javascript:showImage('/images/mypiccy.jpg');">click me</a>
The values in the last bit of the open window call are a comma separated list of parameters, eg "toolbar=no,menubar=no,status=no" etc
Steve
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff