Results 1 to 7 of 7

Thread: pop-up windows in CMotion Image Gallery II

  1. #1
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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

  3. #3
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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

  5. #5
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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)
    }

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •