views:

345

answers:

1

hi,

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 page.

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

+1  A: 

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.

Henrik Opel
ok thanks. So.. let's say I've installed jQuery Media plugin which is parsing my page html to replace some links with a flash video player. I haven't write any javascript code for it, it is automatically triggered my Drupal. How can I trigger it when the lightbox is loaded using Drupal.Behaviors ?
Patrick
Sorry, I do not know the details of the jQuery Media plugin, so I can't say if it uses Drupal.behaviors or not and can't provide detailed instructions. There is an issue in the Modules issue queue that hints on problems in this content: http://drupal.org/node/557882 - maybe this helps.
Henrik Opel

related questions