MrShi
2025-07-04 82d483406921aa92b6ce3a1af5d17d80ccb78256
web/js/about.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
$(document).ready(function() {
    // å½“页面滚动到一定距离时显示返回顶部按钮
    $('#back-to-top').fadeOut();
    dingwei()
    function dingwei() {
        $('.underline').remove()
        if (window.location.href.indexOf('#section1') !== -1) {
            $('#b').append('<div class="underline"></div>')
            console.log('b')
        } else {
            $('#a').append('<div class="underline"></div>')
            console.log('a')
        }
    }
    $(window).scroll(function() {
        if ($(this).scrollTop() > 100) { // è¿™é‡Œå¯ä»¥æ ¹æ®éœ€è¦è°ƒæ•´æ•°å€¼
            $('#back-to-top').fadeIn(); // æ˜¾ç¤ºæŒ‰é’®
        } else {
            $('#back-to-top').fadeOut(); // éšè—æŒ‰é’®
        }
    });
    // ç‚¹å‡»æŒ‰é’®æ—¶ï¼Œé¡µé¢å¹³æ»‘滚动到顶部
    $('#back-to-top').click(function(event) {
        event.preventDefault(); // é˜»æ­¢é“¾æŽ¥çš„默认行为
        $('html, body').animate({scrollTop: 0}, 800); // é¡µé¢å¹³æ»‘滚动到顶部,800毫秒完成滚动
    });
});