url link from within shadow box

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

url link from within shadow box

boogs-2
Is it possible to click on an image displayed in shadowbox to go to another url, either internal or external or alternatively perhaps trigger the title to go to another url?

cheers,

Boogs.
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

Wizzud
Yes, you can use the onFinish callback to set up a click event on the image to do (almost) whatever you want.
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

boogs-2
Thanks Wizuud,

Sorry I am a complete novice at this are you able to provide a quick example.
I have managed to get the basic functionality of shadowbox working but that's it so far.

cheers,

Boogs
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

Wizzud
Simple example using jQuery library:

function clickAndGo(){
  $('img#shadowbox_content').one('click', function(){
      window.location.href = 'http://mjijackson.com/shadowbox';
    });
}
var opts = {onFinish:clickAndGo};
Shadowbox.init(opts);

If you are using another library, the syntax will be different.
If you are using the shadowbox_base, you will have to see if the functions provided by Shadowbox will allow you to do the same thing.

I use jQuery myself, for the simple reason that it makes doing stuff like this so much easier!
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

boogs-2
Thanks Wizzud.
Yep using the shadowbox_base but should be able to work it out from here.

cheers,

Boogs
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

boogs-2
Hi Wizzud,

spoke to soon,
Tried to locate functions for shadowbox_base and had no success.
At the moment just messing around with the syntax but no closer
at this point.
Has anyone else tried to achieve this using the shadowbox_base.

cheers,

Boogs
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

boogs-2
In reply to this post by Wizzud
Thanks Wizzud,

I used the jQuery library and got it working. I had no success with the Shadowbox_base.
One small issue, do you know of any way of having the users cursor change so that it's more obvious
to the end user.

Cheers,

Boogs
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

Wizzud
Chain .css({cursor:'___'}) to the one() call?
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

boogs-2
Thanks again,

cheers,

Boogs
Reply | Threaded
Open this post in threaded view
|

Re: url link from within shadow box

ddave311
In reply to this post by Wizzud
Hi, I'm an ultimate noob and don't know where to edit the code that you have provided.

I would like my image to be clickable and open in an external window... and I have no idea how to do this.

Thank you,
D