﻿{"id":1594,"date":"2019-10-21T13:56:45","date_gmt":"2019-10-21T05:56:45","guid":{"rendered":"http:\/\/jilin.hydesign.tw\/?p=1594"},"modified":"2022-03-23T17:02:34","modified_gmt":"2022-03-23T09:02:34","slug":"jquery-gotop","status":"publish","type":"post","link":"http:\/\/jilin.hydesign.tw\/index.php\/2019\/10\/21\/jquery-gotop\/","title":{"rendered":"jQuery GoTop"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h3 class=\"wp-block-heading\">\u261e \u57fa\u672c\u8a2d\u5b9a<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;script src=\"http:\/\/code.jquery.com\/jquery-latest.min.js\">&lt;\/script>\n&lt;script type=\"text\/javascript\" src=\"\/js\/jquery.min.js\">&lt;\/script>  <\/pre>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h3 class=\"wp-block-heading\">\u261e \u8a9e\u6cd5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">GoTops \u6309\u9215\u4e8b\u4ef6<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;script type=\"text\/javascript\">\n$(function() {\n    \/* \u6309\u4e0bGoTop\u6309\u9215\u6642\u7684\u4e8b\u4ef6 *\/\n    $('#gotop').click(function(){\n        $('html,body').animate({ scrollTop: 0 }, 'slow');   \/* \u8fd4\u56de\u5230\u6700\u9802\u4e0a *\/\n        return false;\n    });\n    \n    \/* \u5075\u6e2c\u5377\u8ef8\u6ed1\u52d5\u6642\uff0c\u5f80\u4e0b\u6ed1\u8d85\u904e400px\u5c31\u8b93GoTop\u6309\u9215\u51fa\u73fe *\/\n    $(window).scroll(function() {\n        if ( $(this).scrollTop() > 400){\n            $('#gotop').fadeIn();\n        } else {\n            $('#gotop').fadeOut();\n        }\n    });\n});\n&lt;\/script>   <\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Scroll \u6d6e\u52d5\u4e8b\u4ef6<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ JavaScript Document\n \n    $(function () {\n        $(\"#1Eb\").click(function () {\n            $('html,body').animate({ scrollTop: $('#1E').offset().top }, 1000);\n            return false;\n        });\n \n        $(\"#1Cb\").click(function () {\n            $('html,body').animate({ scrollTop: $('#1C').offset().top }, 1000);\n            return false;\n        });\n \n        $(\"#2Eb\").click(function () {\n            $('html,body').animate({ scrollTop: $('#2E').offset().top }, 1000);\n            return false;\n        });\n \n        $(\"#2Cb\").click(function () {\n            $('html,body').animate({ scrollTop: $('#2C').offset().top }, 1000);\n            return false;\n        });\n \n        $(\"#3Eb\").click(function () {\n            $('html,body').animate({ scrollTop: $('#3E').offset().top }, 1000);\n            return false;\n        });\n \n        $(\"#3Cb\").click(function () {\n            $('html,body').animate({ scrollTop: $('#3C').offset().top }, 1000);\n            return false;\n        });\n    });\n \n    $(function () {\n        $(\"#gotop\").click(function () {\n            jQuery(\"html,body\").animate({\n                scrollTop: 0\n            }, 1000);\n        });\n        $(window).scroll(function () {\n            if ($(this).scrollTop() > 300) {\n                $('#gotop').fadeIn(\"fast\");\n            } else {\n                $('#gotop').stop().fadeOut(\"fast\");\n            }\n        });\n    });<\/pre>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h3 class=\"wp-block-heading\">\u261e \u986f\u793a<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;div id=\"gotop\">&lt;\/div><\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"css\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;style>\n     #gotop {\n          display: none;\n          background-repeat:no-repeat;\n          background-image:url(..\/images\/backTopBall.png);\n          position: fixed;\n          right: 50px;\n          bottom: 60px;\n          width: 60px;\n          height: 60px;\n          padding: 10px 15px;\n          font-size: 26px;\n          cursor: pointer;\n          vertical-align: middle;\n          font-weight: 900;\n     }\n&lt;\/style><\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u261e \u57fa\u672c\u8a2d\u5b9a \u261e \u8a9e\u6cd5 GoTops \u6309\u9215\u4e8b\u4ef6 Scroll \u6d6e\u52d5\u4e8b\u4ef6 \u261e \u986f\u793a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54,14,12,4],"tags":[],"class_list":["post-1594","post","type-post","status-publish","format-standard","hentry","category-jquery","category-js","category-front-end","category-notes"],"_links":{"self":[{"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/posts\/1594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/comments?post=1594"}],"version-history":[{"count":29,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/posts\/1594\/revisions"}],"predecessor-version":[{"id":7187,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/posts\/1594\/revisions\/7187"}],"wp:attachment":[{"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/media?parent=1594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/categories?post=1594"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/tags?post=1594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}