thaw/demo_markdown/docs/back_top/mod.md
luoxiaozero 1b0f664dc7
Feat/back top (#169)
* feat: thaw_utils adds get_scroll_parent

* feat: add BackTop

* feat: BackTop scroll
2024-04-16 23:00:01 +08:00

1.1 KiB

Back Top

BackTop will find its first scrollable ascendant element and listen scroll event on it.

view! {
    <BackTop />
}

Visibility height

view! {
    <BackTop bottom=100 visibility_height=280>
        <div style="width: 200px; text-align: center;">
            "Visibility Height: 280px"
        </div>
    </BackTop>
}

Change position

view! {
    <BackTop right=40 bottom=160>
        <div style="width: 200px; text-align: center;">
            "Change Position"
        </div>
    </BackTop>
}

BackTop Props

Name Type Default Description
class OptionalProp<MaybeSignal<String>> Default::default() Addtional classes for the back top element.
right MaybeSignal<i32> 40 The width of BackTop from the right side of the page.
bottom MaybeSignal<i32> 40 The height of BackTop from the bottom of the page.
bottom MaybeSignal<i32> 180 BackTop's trigger scroll top.
children Option<Children> None BackTop's content.