1
我需要知道哪些具体类的锚(触发fancybox)必须做更多的行动wie“onComplete”功能。如何获得Fancybox的触发器?
如何获得触发器为jQuery-Object? $(this)接缝引用fancybox本身,没有链接到原始触发器。
解决方案:
$('a.fancybox').click(function(e){
e.preventDefault();
var trigger = $(this);
$.fancybox({
'href' : this.href,
'onComplete' : function() {
if (trigger.hasClass('specific_class')) {
//do something
} else {
//do something else or nothing
}
}
});
});
得好好的,只是添加的事情是event.preventDefault(),这样浏览器将不跟随链接。 谢谢! – Tim 2010-08-03 12:44:43