网页回到顶部 | Go Top

部分页面一键回到顶部

目前为 2021-09-07 提交的版本。查看 最新版本

// ==UserScript==
// @name         网页回到顶部 | Go Top
// @namespace    http://ekozhan.com/
// @version      0.2
// @description  部分页面一键回到顶部
// @author       eko.zhan
// @include      https://github.com*
// @match        *://*.youtube.com/*
// @include      *://*.bilibili.com*
// @icon         https://avatars3.githubusercontent.com/u/3312512

// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let _url = location.href;

    goTop();

    /**
     * go top function
     */
    function goTop(){
        let topBtn = document.createElement('div');
        topBtn.className = 'meg-gotop';
        topBtn.style = 'position:fixed;right:10px;bottom:10px;font-size:24px;font-weight:bolder;cursor: pointer;z-index:1986;';
        topBtn.onclick = function(){window.scrollTo(0, 0);};
        topBtn.innerHTML = '↑↑';
        document.querySelector('body').append(topBtn);
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址