开发者

Jquery problem with plugin

I have PHP page where users can upload photos (using Ajax & PHP script). Those uploaded photos (thumbs) are shown after upload in DIV below upload field and fancybox plugin (I'm using it for popup window for photos) is working ok then.

Then, after hitting send button I want to clone that DIV at that same page at message board, bellow other messages with or without uploaded ph开发者_JAVA技巧otos.

When I try to do that with:

var pht = $("#photos").clone().addClass('p_pht');

and try to display sent photos bellow sent message like this:

$("div#wall").append('<div class=msg>'+ message +'</div><div class=n_pht>'+ pht.html() +'</div>');

Fancybox plugin don't work. Only the link is working but not with popup window as it should be.

What am I doing wrong?


because you've changed the dom the fancybox plugin doesn't know the new elements exist. there are two ways of solving this.

  1. Call the fancybox plugin again when you've finished adding elements
  2. Use jquery live as answered here jquery live & livequery

Hope that helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜