Content loader pattern.

November 2, 2023 ยท View on GitHub

Load remote or local content into a target.


Deprecated

Please use pat-inject from Patternslib instead.


Configuration

OptionTypeDefaultDescription
contentstringnullCSS selector for content, which is going to replace the target. Can be a local element already in the DOM tree or come from an AJAX call by using the url option.
targetstringnullCSS selector of target element, which is being replaced. If it's empty, the pattern element will be replaced.
triggerstring"click"Event to trigger content loading.
urlstringnullTo load content from remote resource. Use 'el' to use with anchor tag href.

Examples

Example 1

Load content

Original Content

Example 2

Load content