From 8271e1f0632506cdeaf6d8d08d39310209cc3ef8 Mon Sep 17 00:00:00 2001 From: sky <1326906378@qq.com> Date: Wed, 12 Oct 2022 22:52:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=94=94=20=E4=B8=8A=E4=BC=A02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wiki/footer.html | 61 ++++++++++++++++++++++++++++++++++++++++++++++-- wiki/menu.html | 36 ++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/wiki/footer.html b/wiki/footer.html index bbd62ed..e9e9523 100644 --- a/wiki/footer.html +++ b/wiki/footer.html @@ -1,3 +1,9 @@ +<div class="goTop"> + + <span>back To top</span> + +</div> + <footer> @@ -74,15 +80,66 @@ </footer> -<div style="font-size: 1.5rem; color: rgb(0, 0, 0);width: 100vw;padding: 30px 20vw;background-color: #fff;"> +<div style="font-size: 1.5rem; color: rgb(0, 0, 0);width: 100vw;padding: 30px 20vw;background-color: #fff;margin: 0 auto;"> <div> <p><small>© 2022 - Content on this site is licensed under a <a style="color: #108b96;" href="https://creativecommons.org/licenses/by/4.0/" rel="license">Creative Commons Attribution 4.0 International license</a>.</small></p> <p><small>The repository used to create this website is available at <a style="color: #108b96;" href="https://gitlab.igem.org/2022/sesame-shenzhen">gitlab.igem.org/2022/sesame-shenzhen</a>.</small></p> </div> </div> - <script> + function goTop(min_height) { + + $(".goTop").click( + + function() { + + $('html,body').animate({ + + scrollTop: 0 + + }, 700); + + }); + + //获å–页é¢çš„æœ€å°é«˜åº¦ï¼Œæ— ä¼ å…¥å€¼åˆ™é»˜è®¤ä¸º600åƒç´ + + min_height=min_height?min_height:400; + + //为窗å£çš„scroll事件绑定处ç†å‡½æ•° + + $(window).scroll(function() { + + //获å–窗å£çš„æ»šåЍæ¡çš„垂直ä½ç½® + + var s = $(window).scrollTop(); + + //当窗å£çš„æ»šåЍæ¡çš„垂直ä½ç½®å¤§äºŽé¡µé¢çš„æœ€å°é«˜åº¦æ—¶ï¼Œè®©è¿”å›žé¡¶éƒ¨å…ƒç´ æ¸çŽ°ï¼Œå¦åˆ™æ¸éš + + if (s > min_height) { + + $(".goTop").fadeIn(100); + + } else { + + $(".goTop").fadeOut(200); + + } + + }); + + } + + + + + + $(function() { + + goTop(); + + }); + $("a[href*=\\#],area[href*=\\#]").click(function() { //若报错则改为$(document).on('click', 'a[href^="#"]', function () { console.log(111) diff --git a/wiki/menu.html b/wiki/menu.html index 2bf21ff..c00caa5 100644 --- a/wiki/menu.html +++ b/wiki/menu.html @@ -14,6 +14,42 @@ margin-top: 27vh; margin-left: 35vw; } + .goTop { + + height: 44px; + + width: 128px; + + background: #509296; + + border-radius: 22px; + + position: fixed; + + top: 90%; + + right: 3%; + + display: none; + + } + + + + .goTop span { + + color: #fff; + + position: absolute; + + top: 12px; + + left: 8px; + width:88%; + margin: 0 auto; + text-align:center; + + } </style> -- GitLab