You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/content/docs/03-template-syntax.md
+40-19Lines changed: 40 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -994,6 +994,12 @@ transition:fn
994
994
transition:fn={params}
995
995
```
996
996
```sv
997
+
transition:fn|global
998
+
```
999
+
```sv
1000
+
transition:fn|global={params}
1001
+
```
1002
+
```sv
997
1003
transition:fn|local
998
1004
```
999
1005
```sv
@@ -1027,7 +1033,28 @@ The `transition:` directive indicates a *bidirectional* transition, which means
1027
1033
{/if}
1028
1034
```
1029
1035
1030
-
> By default intro transitions will not play on first render. You can modify this behaviour by setting `intro: true` when you [create a component](/docs#run-time-client-side-component-api).
1036
+
---
1037
+
1038
+
Transitions are local by default (in Svelte 3, they were global by default). Local transitions only play when the block they belong to is created or destroyed, *not* when parent blocks are created or destroyed.
1039
+
1040
+
```sv
1041
+
{#if x}
1042
+
{#if y}
1043
+
<!-- Svelte 3: <p transition:fade|local> -->
1044
+
<p transition:fade>
1045
+
fades in and out only when y changes
1046
+
</p>
1047
+
1048
+
<!-- Svelte 3: <p transition:fade> -->
1049
+
<p transition:fade|global>
1050
+
fades in and out when x or y change
1051
+
</p>
1052
+
1053
+
{/if}
1054
+
{/if}
1055
+
```
1056
+
1057
+
> By default intro transitions will not play on first render. You can modify this behaviour by setting `intro: true` when you [create a component](/docs#run-time-client-side-component-api) and marking the transition as `global`.
1031
1058
1032
1059
##### Transition parameters
1033
1060
@@ -1153,24 +1180,6 @@ An element with transitions will dispatch the following events in addition to an
1153
1180
{/if}
1154
1181
```
1155
1182
1156
-
---
1157
-
1158
-
Local transitions only play when the block they belong to is created or destroyed, *not* when parent blocks are created or destroyed.
0 commit comments