mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
docs(content): add information on fixed slots (#20324)
closes ionic-team/ionic-docs#731
This commit is contained in:
@ -6,6 +6,12 @@ view.
|
|||||||
|
|
||||||
Content, along with many other Ionic components, can be customized to modify its padding, margin, and more using the global styles provided in the [CSS Utilities](/docs/layout/css-utilities) or by individually styling it using CSS and the available [CSS Custom Properties](#css-custom-properties).
|
Content, along with many other Ionic components, can be customized to modify its padding, margin, and more using the global styles provided in the [CSS Utilities](/docs/layout/css-utilities) or by individually styling it using CSS and the available [CSS Custom Properties](#css-custom-properties).
|
||||||
|
|
||||||
|
|
||||||
|
## Fixed Content
|
||||||
|
|
||||||
|
In order to place elements outside of the scrollable area, `slot="fixed"` can be added to the element. This will absolutely position the element placing it in the top left. In order to place the element in a different position, style it using [top, right, bottom, and left](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
|
||||||
|
|
||||||
|
|
||||||
<!-- Auto Generated Below -->
|
<!-- Auto Generated Below -->
|
||||||
|
|
||||||
|
|
||||||
@ -19,6 +25,11 @@ Content, along with many other Ionic components, can be customized to modify its
|
|||||||
(ionScrollStart)="logScrollStart()"
|
(ionScrollStart)="logScrollStart()"
|
||||||
(ionScroll)="logScrolling($event)"
|
(ionScroll)="logScrolling($event)"
|
||||||
(ionScrollEnd)="logScrollEnd()">
|
(ionScrollEnd)="logScrollEnd()">
|
||||||
|
<h1>Main Content</h1>
|
||||||
|
|
||||||
|
<div slot="fixed">
|
||||||
|
<h1>Fixed Content</h1>
|
||||||
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -26,7 +37,13 @@ Content, along with many other Ionic components, can be customized to modify its
|
|||||||
### Javascript
|
### Javascript
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<ion-content></ion-content>
|
<ion-content>
|
||||||
|
<h1>Main Content</h1>
|
||||||
|
|
||||||
|
<div slot="fixed">
|
||||||
|
<h1>Fixed Content</h1>
|
||||||
|
</div>
|
||||||
|
</ion-content>
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@ -50,6 +67,11 @@ const ContentExample: React.FC = () => (
|
|||||||
onIonScrollStart={() => {}}
|
onIonScrollStart={() => {}}
|
||||||
onIonScroll={() => {}}
|
onIonScroll={() => {}}
|
||||||
onIonScrollEnd={() => {}}>
|
onIonScrollEnd={() => {}}>
|
||||||
|
<h1>Main Content</h1>
|
||||||
|
|
||||||
|
<div slot="fixed">
|
||||||
|
<h1>Fixed Content</h1>
|
||||||
|
</div>
|
||||||
</IonContent>
|
</IonContent>
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
@ -64,6 +86,11 @@ const ContentExample: React.FC = () => (
|
|||||||
@ionScrollStart="logScrollStart()"
|
@ionScrollStart="logScrollStart()"
|
||||||
@ionScroll="logScrolling($event)"
|
@ionScroll="logScrolling($event)"
|
||||||
@ionScrollEnd="logScrollEnd()">
|
@ionScrollEnd="logScrollEnd()">
|
||||||
|
<h1>Main Content</h1>
|
||||||
|
|
||||||
|
<div slot="fixed">
|
||||||
|
<h1>Fixed Content</h1>
|
||||||
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
(ionScrollStart)="logScrollStart()"
|
(ionScrollStart)="logScrollStart()"
|
||||||
(ionScroll)="logScrolling($event)"
|
(ionScroll)="logScrolling($event)"
|
||||||
(ionScrollEnd)="logScrollEnd()">
|
(ionScrollEnd)="logScrollEnd()">
|
||||||
|
<h1>Main Content</h1>
|
||||||
|
|
||||||
|
<div slot="fixed">
|
||||||
|
<h1>Fixed Content</h1>
|
||||||
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
```html
|
```html
|
||||||
<ion-content></ion-content>
|
<ion-content>
|
||||||
|
<h1>Main Content</h1>
|
||||||
|
|
||||||
|
<div slot="fixed">
|
||||||
|
<h1>Fixed Content</h1>
|
||||||
|
</div>
|
||||||
|
</ion-content>
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
@ -8,6 +8,11 @@ const ContentExample: React.FC = () => (
|
|||||||
onIonScrollStart={() => {}}
|
onIonScrollStart={() => {}}
|
||||||
onIonScroll={() => {}}
|
onIonScroll={() => {}}
|
||||||
onIonScrollEnd={() => {}}>
|
onIonScrollEnd={() => {}}>
|
||||||
|
<h1>Main Content</h1>
|
||||||
|
|
||||||
|
<div slot="fixed">
|
||||||
|
<h1>Fixed Content</h1>
|
||||||
|
</div>
|
||||||
</IonContent>
|
</IonContent>
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
@ionScrollStart="logScrollStart()"
|
@ionScrollStart="logScrollStart()"
|
||||||
@ionScroll="logScrolling($event)"
|
@ionScroll="logScrolling($event)"
|
||||||
@ionScrollEnd="logScrollEnd()">
|
@ionScrollEnd="logScrollEnd()">
|
||||||
|
<h1>Main Content</h1>
|
||||||
|
|
||||||
|
<div slot="fixed">
|
||||||
|
<h1>Fixed Content</h1>
|
||||||
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user