Greasy Fork 还支持 简体中文。

Scroll to Top Button

Adds a scroll to top button at the bottom right of the page when scrolled to the bottom, and hides it at the top.

ของเมื่อวันที่ 24-07-2024 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

ผู้เขียน
DXRK1E
คะแนน
0 0 0
เวอร์ชัน
1.5
สร้างเมื่อ
24-07-2024
อัปเดตเมื่อ
24-07-2024
Size
3.27 กิโลไบต์
สัญญาอนุญาต
MIT
ปรับใช้กับ
ไซต์ทั้งหมด

Scroll to Top Button Userscript

This userscript adds a convenient "Scroll to Top" button to web pages. The button appears at the bottom right of the page when scrolled to the bottom, and hides when at the top. It’s designed to enhance the browsing experience by providing quick navigation back to the top of the page.

Features

  1. Scroll to Top Button: A button that allows users to quickly scroll back to the top of the page.
  2. Visibility Control: The button appears only when the page is scrolled to the bottom and hides when at the top.
  3. Smooth Scrolling: The button uses smooth scrolling for a better user experience.

How It Works

  1. Button Creation:

    • The script creates a button element and styles it with CSS for a modern look.
    • The button is initially hidden using CSS properties opacity and visibility.
  2. Scroll Handling:

    • The handleScroll function checks the scroll position of the page and controls the visibility of the button.
    • The button becomes visible when the user scrolls to the bottom of the page and hides when scrolled up.
  3. Scroll to Top Functionality:

    • When the button is clicked, the page smoothly scrolls to the top using window.scrollTo.

Installation

To use this userscript, you need a userscript manager like Violentmonkey, Tampermonkey, or Greasemonkey. Follow these steps:

  1. Install a Userscript Manager:

  2. Adding the Script:

    • Simply click the button labeled "install the script" at the top.