Parcourir la source

Add docs for `.half` and `.full` modifiers. (#2239)

Currently the docs site has no information regarding these modifiers, but they are in the plugin code.
Casper Engelmann il y a 3 ans
Parent
commit
962cae4af4
1 fichiers modifiés avec 22 ajouts et 0 suppressions
  1. 22 0
      packages/docs/src/en/plugins/intersect.md

+ 22 - 0
packages/docs/src/en/plugins/intersect.md

@@ -104,3 +104,25 @@ Sometimes it's useful to evaluate an expression only the first time an element e
 ```alpine
 <div x-intersect.once="shown = true">...</div>
 ```
+
+<a name="half"></a>
+### .half
+
+Evaluates the expression once the intersection threshold exceeds `0.5`. 
+
+Useful for elements where it's important to show at least part of the element.
+
+```alpine
+<div x-intersect.half="shown = true">...</div> // when `0.5` of the element is in the viewport
+```
+
+<a name="full"></a>
+### .full
+
+Evaluates the expression once the intersection threshold exceeds `0.99`. 
+
+Useful for elements where it's important to show the whole element.
+
+```alpine
+<div x-intersect.full="shown = true">...</div> // when `0.99` of the element is in the viewport
+```