Flexible performance tuning, use the inner html of inline content containers #678
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into a situation where inline mode was required and putting 100+ high quality images inside of hidden div tags would compete with other media loading on the page. In other words, this was not an appropriate situation to cache the full scale images before loading by putting them in a hidden div tag, they needed to be loaded on demand. To accomplish this I made the inline HTML containers script tags to prevent the image tag from being interpreted as HTML until it was needed. For example:
The problem is that the script tag itself would also end up in the modal content area resulting in what appeared to be an empty modal. Changing one line in
jquery.colorbox.js
, colorbox now uses the inner HTML of the inline HTML container for the modal content. Not only does this give you cache control, ie. the flexibility of choosing if inline modal content is loaded on page load, it also results in what may be seen as a cleaner approach to when you do want content cached. If anything, it's less verbose.vs.
@jackmoore I submit my pull request here for your consideration. I'm wondering what your thoughts are here on my strategy for cache control. If it is deemed a worthy one, I could roll this pull request as an optional
useInnerHtmlForInlineContainers
setting to make this backwards compatible.