Fancybox onComplete函数未运行 [英] Fancybox onComplete function not running
问题描述
由于某种原因,它只是没有运行onComplete
函数.但是,它确实加载了fancybox div.我的html:
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>
我的jquery:
jQuery('li a').fancybox({
'autoDimensions': 'false',
'width' : 631,
'height': 256,
'onComplete':function(){
alert('running');
jQuery('.fancybox-skin').css('background-color',colour);
}
});
警报不运行.我还尝试将事件函数更改为onClosed
,将其他事件更改为空.
the alert doesn't run. I've also tried changing the event function to onClosed
and the other events, and nothing.
推荐答案
我想您忘记指定要使用的fancybox版本.
I guess you forgot to specify what version of fancybox you are using.
onComplete
是fancybox v1.3.x的回调选项,而引入fancybox-skin
class 直到版本2.x,.....所以我假设您正在使用版本2.x,不是吗?
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选项是新的,并且与以前的版本不兼容; onComplete
(v1.3.x)选项的等效项现在是afterLoad
(v2.x)回调选项.
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.
检查 http://fancyapps.com/fancybox/#docs 以获得完整的选项列表,fancybox v2.x的方法和回调
Check http://fancyapps.com/fancybox/#docs for the complete list of options, methods and callbacks for fancybox v2.x
这篇关于Fancybox onComplete函数未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!