View Full Version : CMotion Gallery Script Question

03-25-2009, 03:13 PM
1) Script Title: CMotion Image Gallery

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/cmotiongallery.htm

3) Describe problem: I'm not actually having a problem with the script since everything seems to be working fine, but I do have one small question. When the full sized image opens in the pop up window, it's scaled to 95% and there's white around the image. I can't figure out why it doesn't just fill the whole window and I know I have the dimensions correct. Does it have something to do with this part of the script?

function enlargeimage(path, optWidth, optHeight){ //function to enlarge image. Change as desired.
var actualWidth=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width
var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to default height
var winattributes="width="+actualWidth+",height="+actualHeight+",resizable=no"
window.open(path,"", winattributes)

My largest image width is 500px and the largest height is also 500px, but every time the window opens there is white space around the image and I need to click it to make it fill the window. Is there any way to change this? I tried making those dimentions larger, but nothing different happened. If you need to see it in action you can temporarily find it here (http://www.scaryguysexoticpets.com/test/shows.html). It's just a test page, so it will be removed once I get it working the way I want. I'm sure the rest of my coding isn't perfect, but I'm not a professional web designer and I don't really expect it to be.

Also, I noticed the Text and Image Crawler script mentioned in another thread here. Can pop-up enlarged images be added to that too? I like the continuous scroll on that one better than the "End of Gallery" thing on the CMotion script.

Thanks in advance!

03-30-2009, 12:46 PM
Does anyone have any suggestions on how to fix this? It's a minor problem and I suppose I'll just leave it as is, if not.

Thanks anyhow.

03-31-2009, 01:54 PM
Different browsers handle images launched into pop up windows in different ways.

You could generate a page via javascript or a server side language to place in the new window so as to format the position of the image and remove any margins or padding from around it. Or just make up a page in ordinary HTML for each larger image for the same purpose.

However, though all these have been done and work, none of them are real simple. And it will be blocked by some browsers. A better approach would be to use something like Lightbox. If you use version 2.04 or better, you won't even need to worry about any onclick events, just setup your images' links with the lightbox syntax.

Lightbox 2.04 (current version 2 page actually, may be updated - at this writing it is version 2.04):


04-02-2009, 01:22 PM
Thank you for the advice and link. The strange margins around the images are showing up in both IE8 and Firefox even though I have another pop up script on a different part of the site which leaves no margin at all around them. I just couldn't figure out what the difference was between this one and that.

I've never used Lightbox before, but I'll certainly take a look! If I can't figure that out, maybe I will just go with html. I appreciate your help and suggestions!:)

04-02-2009, 03:51 PM
I just couldn't figure out what the difference was between this one and that

Which illustrates my point that it is not exactly simple.

The problem with pop ups is that they will be blocked in some browsers. This has nothing to do with the version of the browser or what kind it is, rather its pop up settings.

As I say, there are several approaches to formatting an image into a page before launching it into a pop up. These have nothing to do with pop ups in general having the vulnerability I've mentioned.

All pop ups are vulnerable to blocking.