开发者

Jquery Fancybox - $.post() Postback

I currently assign elemen开发者_如何转开发ts to Fancybox as follows:

$(document).ready(function(){
$(".popup").fancybox({
 'speedIn'  : 600, 
 'overlayOpacity'  : 0.7,
 'speedOut'  : 200
});

}); When I load remote content using $.post(), some of that content contains...

<a class="popup" href="#somebox">Click me</a>.

Clicking the link does nothing, probably because the document ready only gets processed once on page load. How can I 'reprocess' this so that links in the remote content open up the fancybox?

I've looked around must most of the solutions are ASP.net based. I am currently using standard PHP and jQuery.

Thanks.


You could set your own click event on these links, using .live():

$(".popup").live('click', function(){
  $.fancybox({
    'speedIn': 600, 
    'overlayOpacity': 0.7,
    'speedOut': 200,
    'href': $(this).attr('href')
  });
  return false;
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜