PDA

View Full Version : Set window size on click link - ultimate fade in slideshow



daithi
08-08-2006, 11:29 AM
Ultimate Fade-In Slideshow (v1.5)

http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.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

jscheuer1
08-08-2006, 03:17 PM
How are you opening the new window? I imagine something like so:


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:


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:


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

daithi
08-08-2006, 03:25 PM
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!

Spacey
02-15-2007, 01:09 PM
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:



.
.
.
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! :D

jscheuer1
02-15-2007, 01:37 PM
I'd try:


.
.
.
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:


.
.
.
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.

Spacey
02-15-2007, 01:52 PM
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 ;)

Spacey
02-15-2007, 02:06 PM
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....

jscheuer1
02-15-2007, 02:31 PM
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):


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
}

Spacey
02-15-2007, 02:44 PM
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... ;)