Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fancybox onComplete function not running

For some reason it's just not running the onComplete function. It does however load the fancybox div. My html:

<ul>
    <li class="orange">

           #1 <a href="#text">click here</a>

           <div id="text" class="text">text text text</div>

    </li>
</ul>

My jquery:

 jQuery('li a').fancybox({       
    'autoDimensions':   'false',
    'width' :   631,
    'height':   256,        
    'onComplete':function(){

        alert('running');
        jQuery('.fancybox-skin').css('background-color',colour);
    }
});

the alert doesn't run. I've also tried changing the event function to onClosed and the other events, and nothing.

like image 869
Claire Avatar asked May 30 '12 12:05

Claire


2 Answers

I guess you forgot to specify what version of fancybox you are using.

onComplete is a callback option for fancybox v1.3.x while the fancybox-skin class was introduced until version 2.x, ..... so I assume that you are using version 2.x, aren't you?

Fancybox v2.x options are new and not compatible with previous versions; the equivalent for the onComplete (v1.3.x) option is now the afterLoad (v2.x) callback option.

Check http://fancyapps.com/fancybox/#docs for the complete list of options, methods and callbacks for fancybox v2.x

like image 74
JFK Avatar answered Sep 21 '22 14:09

JFK


afterShow I think is the proper equivalent to onComplete in Fabxybox 2

like image 22
Junaid Bhura Avatar answered Sep 18 '22 14:09

Junaid Bhura