JulianJ JulianJ - 1 year ago 58
jQuery Question

Where should I add afterLoad to some jquery code

I'm trying to add a piece of javascript to a fancybox image but I'm not sure the correct place to put it. I'd really appreciate it if someone could show me where to add this :

afterLoad: function () {
this.outer.append("

to this code:

$(document).ready(function() {

afterShow: function () {
$(".fancybox-image").wrap($("<a />", {
href: this.href, //or your target link
target: "_blank"



I've made a fiddle here

Answer Source

Simply add it to the options being passed to fancybox:

    afterShow: function () { /.../ },
    afterLoad: function () { /.../ }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download