Flyer53 / jsPanel3

A jQuery Plugin to create highly configurable floating panels, modals, tooltips, hints/notifiers or contextmenus for use in a backend solution and other web applications.
http://v3.jspanel.de/
Other
89 stars 21 forks source link

[QUESTION/NFR] Ability to reuse DOM element as source for content #15

Closed temuri416 closed 8 years ago

temuri416 commented 8 years ago

Hi Stefan,

Got a question/suggestion.. I'm trying to use $('#myModalContent') as the source for jsPanel's content.

But if that panel has Close button enabled and gets closed, there's no way to reopen the modal as source DOM element no longer exists.

  1. What approach would you recommend if I want to point to DOM element for source?
  2. Would it be possible for jsPanel to always clone original DOM so it's available to subsequent open calls?

Thank you!

Flyer53 commented 8 years ago

Hey there,

did you ever take a look at jQuery's .clone() method?

http://api.jquery.com/clone/

On first sight it seems to be exactly what you need.

temuri416 commented 8 years ago

Hi,

I think you misunderstood me. It is jsPanel that should clone source element. Once I initialize jsPanel - my source DOM element has disappeared.

Flyer53 commented 8 years ago

Mmmmh, what I understood is ...

You have some content already in the document you want to clone in order to append the clone to the content section of a jsPanel yet to create. The original content will remain at its place (and thus usable again) because only the clone is appended to the panel.

For this scenario I created an example using jQuery's .clone() method within the api docs of option.content. Take a look at example 5 http://jspanel.de/api/#option/content

temuri416 commented 8 years ago

Oh.. Now I see what you meant by me using .clone()! Thank you, I did not realize that trick would work.