开发者

Lightbox: how to parse the lightbox dynamically loaded html content (AJAX)

I'm using a (modal) lightbox on a page of my website to display my nodes.

I'm using some plugins such as an external jquery-plugin for tooltips and the drupal plugin jQuery Media (to load flash video player for some video file-fields).

These plugins are loaded when the main page load and they parse the html content of the pag开发者_如何学编程e.

When I dynamically load the lightbox (and I use AJAX to update its content) the html inside the lightbox is not parse... so no tooltips, no videos.

how can I solve this ? Should I trigger the plugins again from Lightbox callback function ? Or should I use something else instead of the lightbox ?

Thanks


These plugins are loaded when the main page load and they parse the html content of the page

If those plugins are implemented as Drupal.Behaviors (as they should, instead of just firing on .ready() or .onload()), you just need to call Drupal.attachBehaviors(yourAjaxResponseContent) on the dynamically loaded content. See http://drupal.org/node/205296 and http://drupal.org/node/114774#javascript-behaviors for some details on this mechanism.

If the plugins do not use the Drupal.behavior route, you'll either need to modify them to do so (recommended), or manually trigger them to process the new content yourself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜