Results 1 to 9 of 9

Thread: Set window size on click link - ultimate fade in slideshow

  1. #1
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Set window size on click link - ultimate fade in slideshow

    Ultimate Fade-In Slideshow (v1.5)

    http://www.dynamicdrive.com/dynamici...nslideshow.htm

    There is probably a very easy solution to this - but I just can't get it! When user clicks on an image in the slideshow, I want this to open a new window with the full sized image. I have created the new page with just the full size image and a little 'close me' link. However, the page opens in full size window.

    How can I set the size so that it matches the image?

    Thanks,

    Daithi

  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

    How are you opening the new window? I imagine something like so:

    Code:
    fadeimages[2]=["photo3.jpg", "photo3_big.htm", "_new"] //image with link and target syntax
    What you seem to be asking for is how to use the window.open() method with this script. The window.open() method has many optional specifications (which you can look up at your leisure) but, a simple execution of it that can control the size of the new window would be:

    Code:
    window.open('photo3_big.htm','','width=160, height=235')
    To use this in the script in question takes a bit of maneuvering, here is one way:

    Code:
    fadeimages[2]=["photo3.jpg", "javascript:void(window.open('photo3_big.htm','','width=160, height=235'));", ""]
    - John
    ________________________

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

  3. #3
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re

    Thank you very much John,
    I knew it would probably be something along those lines, but I'm jsut not smart enough to come up with the solution myself!

  4. #4
    Join Date
    Feb 2007
    Location
    Berlin, Germany
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Another one :)

    Hiyas!

    I'm using this great script within a wordpress-plugin called "Ultimate Gallery2 Slideshow" -> http://chunkymoon.com/wordpress/?p=1

    It run's really great and already opens the photo after a click in a new window - but I just want to set the size and remove controls of that new window. It's a bit javascript code within javascript - and I'm not a coder, just shuffling around lines when I need. And here my hairs are getting grey

    So far I tried to modify the stuff on my own for hours with several ideas - new functions with "open.window" and whatever...

    Then I already found that hint here which should exactely fit my needs, but my lines look a bit different then the ones shown above and I'm totally stuck with all these """'s... What I tried so far gave me only parsing errors.

    My code to alter looks like this:

    Code:
    .
    .
    .
    print "fadeimages[$i] = [\"" . $current_galleryurl ."main.php?g2_view=core.DownloadItem&g2_itemId=$g_id\",";
    
    print "\"" . $current_galleryurl ."main.php?g2_view=core%3AShowItem&g2_itemId=$g_source\", \"\"];\n";
    .
    .
    .
    I'd be very thankful if a coding expert could put in the needed lines shown above in that pice of code, second line to be edited I guess

    Thanks a lot!

  5. #5
    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'd try:

    Code:
    .
    .
    .
    print "fadeimages[$i] = [\"" . $current_galleryurl ."main.php?g2_view=core.DownloadItem&g2_itemId=$g_id\",";
    
    print "\"javascript:void(window.open('" . $current_galleryurl ."main.php?g2_view=core%3AShowItem&g2_itemId=$g_source','','width=300,height=250'))\", \"\"];\n";
    .
    .
    .
    and, if that gives you a parse error, then try it this way:

    Code:
    .
    .
    .
    print "fadeimages[$i] = [\"" . $current_galleryurl ."main.php?g2_view=core.DownloadItem&g2_itemId=$g_id\",";
    
    print "\"javascript:void(window.open(\'" . $current_galleryurl ."main.php?g2_view=core%3AShowItem&g2_itemId=$g_source\',\'\',\'width=300,height=250\'))\", \"\"];\n";
    .
    .
    .
    Notes: This relies upon the code you furnished in your post being error free. To avoid confusing '' and ", copy and paste my code rather than trying to read it with your eyes and type it.
    - John
    ________________________

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

  6. #6
    Join Date
    Feb 2007
    Location
    Berlin, Germany
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    One zillion Thanks to you! The first one worked perfect!!
    And thanks for the C&P hint, otherwise I'd go with reading & manual writing

  7. #7
    Join Date
    Feb 2007
    Location
    Berlin, Germany
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Argh.... both pices of code work in Firefox (Mac & Win), Safari - but not in WinIE.... there the window opens but the javascript-call is shown in the URL....
    Last edited by Spacey; 02-15-2007 at 02:19 PM.

  8. #8
    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 was a little concerned about something like that happening in IE. It is most likely due to a quirk in the IE browser. What happens is that as soon as a link is fired, the page goes into 'unload mode'. This halts script processing.

    Another way to do this without causing that would be to abandon editing the part of the code we were focusing on. Change it back to what you had before if you haven't already. Instead we will edit the Ufade script here (addition red):

    Code:
    fadeshow.prototype.populateslide=function(picobj, picindex){
    var slideHTML=""
    if (this.theimages[picindex][1]!="") //if associated link exists for image
    slideHTML='<a href="'+this.theimages[picindex][1]+'" onclick="window.open(this.href,\'\',\'width=300,height=250\');return false;" target="'+this.theimages[picindex][2]+'">'
    slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
    if (this.theimages[picindex][1]!="") //if associated link exists for image
    slideHTML+='</a>'
    picobj.innerHTML=slideHTML
    }
    - John
    ________________________

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

  9. #9
    Join Date
    Feb 2007
    Location
    Berlin, Germany
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Again thanks big time, mate! Now it works perfect!

    I already tried to change that line with some similar stuff - but like said above I failed for hours finding the correct syntax...

    Didn't test it with opera so far but I guess if FF, IE & Safari will do it...

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
  •