Web Design Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignWeb Design Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 9th, 2004, 08:58 PM
jamesbak jamesbak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 124 jamesbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 m 26 sec
Reputation Power: 5
Open Images In Small Window

I have seen sites where by when a user clicks on an image it opens in a separate smaller window that exactly fits the image. I also noted that this window can be closed.

How can I do this? Please advise. Thanks

Reply With Quote
  #2  
Old September 10th, 2004, 02:31 PM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 36 m 40 sec
Reputation Power: 92
The image will need to be a link, like this:

Code:
<a href="javascript:enlarge('largeimage.htm');"><img src="images/image.gif" width="50" height="50" alt="Click to enlarge" /></a>


Then at the top of that page, you'd need the following javascript:

Code:
<script type="text/javascript">
function enlarge(x)  {
	window.open(x, 'largeimage','menubar=no,status=no,scrollbars=no,toolbar=no,resizable=no,width=500,height=350');
}
</script>


You can easily change the "no" to a "yes" if you want to change the appearance of the new window.

Then, just make sure you have a largeimage.htm, with the <img> tag, and also the following CSS:

Code:
<style type="text/css">
<!--
body {
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	margin-left: 0px;
}
-->
</style>


You need that to get rid of the border.
__________________
- Edwin -

The General Rules Thread | The General FAQ Thread

Last edited by edwinbrains : October 14th, 2004 at 10:56 AM. Reason: woops, small error in the code

Reply With Quote
  #3  
Old October 14th, 2004, 10:01 AM
jamesbak jamesbak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 124 jamesbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 m 26 sec
Reputation Power: 5
How Can I Make The Window To Auto Resize??

How do I customize the window to auto resize for each of the photos as they will be different sizes. Is it also possible to add descriptions to the photo?

Please take a look at what I did (attached). Thank you for your help.
Attached Files
File Type: zip openwindow.zip (44.4 KB, 79 views)

Reply With Quote
  #4  
Old October 14th, 2004, 10:55 AM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 36 m 40 sec
Reputation Power: 92
The following code should work for resizing:

Code:
<a href="javascript:enlarge('largeimage.htm',600,480);"><img src="images/image.gif" width="50" height="50" alt="Click to enlarge" /></a>


Code:
<script type="text/javascript">
function enlarge(x,w,h)  {
	window.open(x, 'largeimage','menubar=no,status=no,scrollbars=no,toolbar=no,resizable=no,width='+w+',height='+h);
}
</script>


What do you mean by descriptions? You could add some text to the alt tag.

Reply With Quote
  #5  
Old October 14th, 2004, 12:19 PM
jamesbak jamesbak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 124 jamesbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 m 26 sec
Reputation Power: 5
Quote:
Originally Posted by edwinbrains
The following code should work for resizing:

Code:
<a href="javascript:enlarge('largeimage.htm',600,480);"><img src="images/image.gif" width="50" height="50" alt="Click to enlarge" /></a>


Code:
<script type="text/javascript">
function enlarge(x,w,h)  {
	window.open(x, 'largeimage','menubar=no,status=no,scrollbars=no,toolbar=no,resizable=no,width='+w+',height='+h);
}
</script>


What do you mean by descriptions? You could add some text to the alt tag.


For the description, I meant like below the photo to explain what the photos is about. Basically I want to use this a catalogue and people might want to know the specifics of this product or whatever. You get what I mean?

Thanks for the help, I do appreciate.
Jim

Reply With Quote
  #6  
Old October 14th, 2004, 03:31 PM
jamesbak jamesbak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 124 jamesbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 m 26 sec
Reputation Power: 5
I dont think the auto resizing is working or I have things wrong! The windows appear too big.

The 2 window is too large and also the window for the first image does not fit the image either. Here is the code I used:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Open in a small window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">
function enlarge(x,w,h) {
window.open(x, 'largeimage','menubar=no,status=no,scrollbars=no,toolbar=no,resizable=no,width='+w+',height='+h);
}
</script>

</head>

<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="80"><a href="javascript:enlarge('largeimage.htm',600,480);"><img src="goat1.jpg" alt="Click to enlarge" width="80" height="66" border="0"></a></td>
<td width="15">&nbsp;</td>
<td width="70"><a href="javascript:enlarge('hen.htm');"><img src="hen1.jpg" width="70" height="97" border="0"></a></td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

Reply With Quote
  #7  
Old October 15th, 2004, 01:17 PM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 36 m 40 sec
Reputation Power: 92
Quote:
Originally Posted by jamesbak
I dont think the auto resizing is working or I have things wrong! The windows appear too big.

The 2 window is too large and also the window for the first image does not fit the image either. Here is the code I used:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Open in a small window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">
function enlarge(x,w,h) {
window.open(x, 'largeimage','menubar=no,status=no,scrollbars=no,toolbar=no,resizable=no,width='+w+',height='+h);
}
</script>

</head>

<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="80"><a href="javascript:enlarge('largeimage.htm',600,480);"><img src="goat1.jpg" alt="Click to enlarge" width="80" height="66" border="0"></a></td>
<td width="15">&nbsp;</td>
<td width="70"><a href="javascript:enlarge('hen.htm');"><img src="hen1.jpg" width="70" height="97" border="0"></a></td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

I've used the exact code that you're using and the first link works fine. It opens a window that is 600x480 big (as specified in the link). The second one doesn't work because you've not added the dimensions. You need to edit the link to include the appropiate width/height.

Code:
<a href="javascript:enlarge('hen.htm',500,400);"><img src="hen1.jpg" width="70" height="97" border="0"></a>


Don't forget that these htm files will have a white border around them by default, unless you use the css code at the top of this thread to get rid of that.

Reply With Quote
  #8  
Old October 15th, 2004, 01:19 PM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 36 m 40 sec
Reputation Power: 92
Quote:
Originally Posted by jamesbak
For the description, I meant like below the photo to explain what the photos is about. Basically I want to use this a catalogue and people might want to know the specifics of this product or whatever. You get what I mean?

Thanks for the help, I do appreciate.
Jim

I understand what you mean, but where do you want the description? Just make the largeimage.htm and hen.htm files include a description as well as the image.

Reply With Quote
  #9  
Old October 15th, 2004, 08:00 PM
jamesbak jamesbak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 124 jamesbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 49 m 26 sec
Reputation Power: 5
Great, thanks!

Quote:
Originally Posted by edwinbrains
I understand what you mean, but where do you want the description? Just make the largeimage.htm and hen.htm files include a description as well as the image.


Thank you so much. You have proved what I was doubting and I have learned a great deal from this.

I appreciate

Reply With Quote
  #10  
Old October 16th, 2004, 02:32 AM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 36 m 40 sec
Reputation Power: 92
Glad I could help

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignWeb Design Help > Open Images In Small Window


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |