2

What is the best/optimal way to change the html of a lightbox?

Say I have 20 table rows, and I want to pop them up in a fancybox. The choices are:

  1. Load the detailed view in an iframe as pure html (1 http request per popup)
  2. Load the details as JSON, and pass them into an inline javascript template to create the popup
  3. Load the details, and traverse the DOM of the popup and place the JSON values in the right spots (e.g. $("#popup .title").text(model.title);)
  4. Load the details as hidden inline server-generated HTML, and clone the html into the popup $("#popup").html($(".details", row).clone()).

The added HTML is what you'd find in a profile (links, description, logo, address, etc.), so it's not a ton but not a single line either.

Are there any standards here on what's the fastest in terms of javascript?

0

1 Answer 1

1

Option #2. No competition efficiency-wise.

Sign up to request clarification or add additional context in comments.

1 Comment

I think option 4 would compete quite well if the popup is shown often enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.