Results 1 to 2 of 2

Thread: Auto Centering Pop-up Window Script

  1. #1
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Auto Centering Pop-up Window Script

    Is it possible to use the Auto Centering Pop-up window script
    http://www.dynamicdrive.com/dynamici...autocenter.htm

    in tandem with the Image Thumbnail Viewer II script?
    http://www.dynamicdrive.com/dynamici...thumbnail2.htm

    Using the latter script, I have thumbnails that spawn the fullsize image on the page. Now, I want that fullsize image to spawn a pop-up window using the "Auto Centering" or any other script possible when clicked.

    Is this crazy thing possible?

  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

    Put both scripts on your page as per instructions. Since the thumb script already provides for links to be associated with each larger sized image, use that to set the urls. Then in the thumb script change this line:
    Code:
    imghtml='<a href="'+theimg[1]+'" target="'+optlinktarget+'">'
    to:
    Code:
    imghtml='<a href="'+theimg[1]+'" onclick="NewWindow(this.href,\'newWin\',400,400,1);return false">'
    The number one at the end is for scrollbars=yes, use a zero for scrollbars=no. This will work fine if all your pop-ups are to be 400x400 or you can edit these numbers to suit but, all pop-ups will follow those dimensions. If you need each pop-up to follow unique dimensions, a little more work is needed. Add the dimensions to the image array, ex:
    Code:
    var dynimages=new Array()
    dynimages[0]=["photo1.jpg", "http://www.cnn.com", 400, 320]
    dynimages[1]=["photo2.jpg", "http://www.yahoo.com", 350, 200]
    dynimages[2]=["photo3.jpg", "http://www.google.com", 375, 188]
    and our line that we edited above now becomes:
    Code:
    imghtml='<a href="'+theimg[1]+'" onclick="NewWindow(this.href,\'newWin\','+theimg[2]+','+theimg[3]+',1);return false">'
    If you go this route, you must configure dimensions in the array for all images that have links.
    - John
    ________________________

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

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
  •