Skip to content

Lazy behaviors

Mike Byrne edited this page Dec 24, 2021 · 1 revision

Behavior is only run if element comes close to being in view. If the behavior module is not already loaded, then then an attempt to import the module will be made and then the behavior will be initialised.

<div data-behavior-lazy="MyBehavior">
  ...
</div>

With options:

<div data-behavior-lazy="MyBehavior" data-mybehavior-foo="bar">
  ...
</div>