Last active
January 26, 2024 18:08
-
-
Save johndwells/f121297d0999c52dfa775b3daf5232cd to your computer and use it in GitHub Desktop.
Lazyload DOM fragment with AlpineJS + Unpoly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div up-id="replace-me-lazy"> | |
Hello, world! | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- onload, will be replaced with contents from `/fragment` --> | |
<div up-id="replace-me-lazy" | |
x-data | |
x-init="up.render({ target: '[up-id=replace-me-lazy]', url: '/fragment' })"> | |
<!-- placeholder content can go here --> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ensure that a DOM element with
up-id="replace-me-lazy"
is present in both the initial page response, and the fragment response.