Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Editing margins in pop-up windows
Old 03-05-2006, 04:17 AM Editing margins in pop-up windows
Junior Talker

Posts: 1
Trades: 0
I have a gallery page where I have thumbnails that, when clicked, opens up a pop up with the full size image. The window links directly to the image and is set to the image's exact dimensions, but it has a slight white border around the left and top, and cuts it off. Here's a sample of the code:

Code:
<a href="#" class="linkopacity" onClick="MM_openBrWindow('portfolio/majestic.jpg','','width=420,height=750')" onMouseOver="MM_swapImage('preview','','portfolio/thumbs/thumb_majestic.jpg',1)" onMouseOut="MM_swapImgRestore()"><img src="portfolio/thumbs/mini_majestic.jpg" name="thumb5" width="30" height="100" border="0" id="thumb5"></a>
Is there a way to get rid of the margins that appear by default when you link directly to an image? I can get rid of them on my normal pages with

Code:
body { margin: 0px; }
but is there a way to do it with these pop ups?


Thanks in advance.
huang is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-05-2006, 01:23 PM Re: Editing margins in pop-up windows
Super Talker

Posts: 144
Trades: 0
well, you can do a couple things. the easier, of course would be to use server-side such as ASP or PHP and pass the image path along the URL. Then you can use HTML to define your page and the image tag would be something like,

<img src="<?= $_GET["imagePath"]?>"> in PHP

<img src="<%= request.queryString("imagePath")%>"> in ASP

of course, you will need the width and height attributes, so it may be wise to send those as well.

If you are not using any server-side then you can use javascript in a couple ways.

1, is to follow the same example as above, but use this function to get url variables,
Code:
location.getVar = function(getVar) {
  var oRegExp = new RegExp(getVar +"=([^&.]+)", "i");
  if (!oRegExp.test(this.href)) return false;
  oRegExp.exec(this.href);
  return RegExp.$1;
}
 
document.write("<img src=\""+ location.getVar("imagePath") +"\">");
2, is to generate the window completely via javascript
Code:
var thumbNailWin = null;
function generateWindow(imagePath, width, height) {
  if (!thumbNailWin || thumbNailWin.closed)
    thumbNailWin = window.open("about:blank", "thumbNailWin", "width="+ width +",height="+ height +",status=0,menubar=0");
  else
    thumbNailWin.location.href = "about:blank";  // to clear the html (we are using the same window each time)
  thumbNailWin.document.write("<html><head><title>my title</title></head><body style=\"margin:0px; overflow:hidden;\">");
  thumbNailWin.document.write("<img src=\""+ imagePath +"\" width=\""+ width +"\" height=\""+ height +"\">");
  thumbNailWin.document.write("</body></html>");
  thumbNailWin.focus();
  thumbNailWin.resizeTo(width, height);        // resize the window
}
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Reply     « Reply to Editing margins in pop-up windows
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10542 seconds with 12 queries