I have a quick question, (I hope it is quick one).
I have fancybox plugin (jquery) -- http://fancybox.net/
$(".Sets a").fancybox({
'onComplete' : function(){
$('#fancybox-inner').prepend('<a href="#">'+ **clicked element rel** +'</a>')}
});
There is a right way, to take this value, in my head now I can see , just to add a class for clicked element, at with this class can help me to detect which element was clicked.
Will be awesome to have something like
$(".Sets a").fancybox({
'onComplete' : function(){
$('#fancybox-inner').prepend('<a href="#">'+ $(this).a开发者_Python百科ttr("rel") +'</a>')}
});
Thank you !!!
To get the $(this)
you need to add a click handler to it.
Call your fancybox this way:
$('.Sets a').click(function(){
var _this = $(this);
$.fancybox({
'onComplete':function(){
$('#fancybox-inner').prepend('<a href="#">'+ _this.attr("rel") +'</a>');
}
})
});
精彩评论