iaian7 / mediaboxAdvanced

mediabox displays flash, video, audio, & html content in a modal dialog. Based on Slimbox and the Mootools javascript library.
http://iaian7.com/webcode/mediaboxAdvanced
85 stars 29 forks source link

set of inline elements #2

Open snillo opened 13 years ago

snillo commented 13 years ago

Hi,

i use mediabox to display a set of "inline" elements. After closing the mediabox following code gets executed in function close()

    if (mediaType == "inline" && !options.inlineClone) {
        preload.adopt(image.getChildren()); // prevents loss of adopted data
    }

As far as i understood when opening the inline elment in the lightbox, Mediabox will MOVE the original inline html in to the lightbox. Thus the original placeholder gets emptied. After closing the Mediabox the moved inline html is injected in original placeholder again. The code above will do that. Anyway, when using a set of inline elements, after clicking on "next" or "prev" the moved html will not be reinjected --> the HTML get lost and next time opening the lightbox will result in a black box without content... So i think the code from above has to be in function next() and function previous() too. At least this is working for me.

Notes: I'm using v. 1.4.5 ... same behaviour with v. 1.5.4 .. inlineClone is set to false (default option, when setting to true i get a JS error)

Btw. i want to say thanks for this GREAT lightbox. I tested a lot of lightboxes but this one is the best, really really flexible. Thank you :)

iaian7 commented 13 years ago

Whoops, looks like I left some work half-finished...I spent a long weekend a couple months ago trying to figure out how to clone elements with attached events (utterly failed, Mootools does NOT make it easy - it looked like I'd have to do it on an individual element basis), then trying to remove/move/replace elements without losing the data (also failed, inexplicably - I have no idea why mediaboxAdvanced kept losing stuff that I was explicitly not allowing it to lose). All that to say, I think I left some of the failed code behind. Until the core can be reworked with a fully-modern structure (several people have offered to help on the Google Groups, but I'm still waiting on feedback), it'll probably need to default to the old style (clone, not move). It may not be working correctly right now, will have to take a look. Sorry about that! It may be a bit before I have a chance to review. :(

Iaian7 / John Einselen

On Jul 8, 2011, at 11:43 AM, snillo wrote:

Hi,

i use mediabox to display a set of "inline" elements. After closing the mediabox following code gets executed in function close()

  if (mediaType == "inline" && !options.inlineClone) {
      preload.adopt(image.getChildren()); // prevents loss of adopted data
  }

As far as i understood when opening the inline elment in the lightbox, Mediabox will MOVE the original inline html in to the lightbox. Thus the original placeholder gets emptied. After closing the Mediabox the moved inline html is injected in original placeholder again. The code above will do that. Anyway, when using a set of inline elements, after clicking on "next" or "prev" the moved html will not be reinjected --> the HTML get lost and next time opening the lightbox will result in a black box without content... So i think the code from above has to be in function next() and function previous() too. At least this is working for me.

Notes: I'm using v. 1.4.5 ... same behaviour with v. 1.5.4 .. inlineClone is set to false (default option, when setting to true i get a JS error)

Btw. i want to say thanks for this GREAT lightbox. I tested a lot of lightboxes but this one is the best, really really flexible. Thank you :)

Reply to this email directly or view it on GitHub: https://github.com/iaian7/mediaboxAdvanced/issues/2