I am new to this so not sure if this is the right place, but can someone tell me how to change the background colour (want black) of the pop-up image windows in CMotion Image Gallery II?
Thanks
I am new to this so not sure if this is the right place, but can someone tell me how to change the background colour (want black) of the pop-up image windows in CMotion Image Gallery II?
Thanks
Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Here is the link - http://www.dynamicdrive.com/dynamici...ongallery2.htm
I am assuming that you are showing a larger sized image, not a page.
I really think that there are much better ways to present a larger sized image with this script than with a pop up. But, if that's the way that you want to go (that has been the default method with Cmotion from before I ever got involved with it, and is perhaps the easiest method), use this enlargeimage() function in motiongallery2.js instead of the default:
Code:function enlargeimage(path, optWidth, optHeight){ //function to enlarge image. Change as desired. try { enlargeimage.popwin.close(); } catch(e){}; var actualWidth=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to default height if(screen.availWidth){ var cw=screen.availWidth/2, ch=screen.availHeight/2; enlargeimage.atop=ch-parseInt(actualHeight)/2, enlargeimage.aleft=cw-parseInt(actualWidth)/2; } var winattributes="width="+actualWidth+",height="+actualHeight+(typeof enlargeimage.atop==='number'? ',top='+Math.min(enlargeimage.atop,150)+',left='+enlargeimage.aleft:'')+",resizable=yes" enlargeimage.popwin=window.open("","popwin", winattributes); enlargeimage.popwin.document.write('<body style="text-align:center;background-color:black;color:#dddddd;" onblur="self.close();" onload="document.images[0].style.marginTop=('+[parseInt(actualHeight)-30]+'/2-document.images[0].height/2)+\'px\';"><img src="'+path+'">'); enlargeimage.popwin.document.close(); enlargeimage.popwin.focus(); }
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Thank you, I tried the script that you provided, but although the background is black, the images are now positioned to one side and there is just a strip of black on the left, whereas the script I was using below seemed to show a balanced border all around when I specified the size of the images to be loaded - any suggestions, or any ideas for a better way of doing this, as you mentioned that there are better ways.
Your help is most appreciated.
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=yes"
window.open(path,"", winattributes)
}
Works fine here:
http://home.comcast.net/~jscheuer1/side/cmotion2.htm
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Hi John
You are right, I hadn't added extra pixels onto the size of the image in the script in the body of the page, but once I did that it works great.
Thanks so much for your help.
Bookmarks