?
Solved

Image Pop Up in new Window (same size as image)

Posted on 2012-03-21
2
Medium Priority
?
259 Views
Last Modified: 2012-04-27
Is there a way to make an image open in a new window showing a larger image of the same image? I want to make the window the same size of the image. I have lots of images (maps) so I hoping to use a javascript of something like (onclick open _blank)
0
Comment
Question by:Turfimage
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
Rose Babu earned 800 total points
ID: 37752243
Hi,

get the image's height and width and use the same in the popupwindow property as like below.
<script language="javascript" type="text/javascript">
function imgPopup(imgURL) {
	x = new Image;
	x.src = imgURL;

	imgW = x.width;
	imgH = x.height;

	newwindow = window.open(imgURL, 'name', 'height=' + imgH + ',width=' + imgW + '');
	if (window.focus) {
		newwindow.focus()
	}
}
</script>


<img src="http://whatisprogramming.com/files/2011/10/javascript1.jpg" 
     onclick="imgPopup('http://whatisprogramming.com/files/2011/10/javascript1.jpg')" />

<img src="http://nabtron.com/wp-content/uploads/2011/09/javascript1.png" 
     onclick="imgPopup('http://nabtron.com/wp-content/uploads/2011/09/javascript1.png')" />

Open in new window

Hope this will work for you.
0
 

Author Comment

by:Turfimage
ID: 37904060
Yes this works.... Is there a way to make the new window pop up be ' resizable=yes '
  and add a 'menubar=yes' In this script?
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question