
会员总数
文章总数
浏览总数
今日发布
稳定运行




在键盘上按Ctrl+D即可
喜欢本站的话记得常来哦!
感谢您的赞赏支持!
', function(){}); } }); // 返回顶部点击事件 $('#percentage').on('click', function(e) { e.preventDefault(); $('html, body').animate({scrollTop: 0}, 500); }); // 评论跳转 $('.pl a').on('click', function(e) { e.preventDefault(); if ($('#comments').length) { $('html, body').animate({ scrollTop: $('#comments').offset().top - 100 }, 500); } }); // 点赞功能 $('.like-btn').on('click', function(e) { e.preventDefault(); var $this = $(this); var post_id = $this.data('id'); $.ajax({ url: '', type: 'POST', data: { action: 'post_like', post_id: post_id }, success: function(response) { if (response.success) { layer.msg('点赞成功!', {icon: 1}); // 更新点赞数 $this.html('点赞(' + response.data.count + ')'); } else { layer.msg(response.data.message || '点赞失败', {icon: 2}); } } }); }); }); // 滚动进度条百分比 - 修复显示问题 window.onscroll = function() { let scrollNow = window.pageYOffset; let pageClientHeight = document.documentElement.clientHeight; let scrollHeight = Math.max( document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight ) - pageClientHeight; // 防止除零错误 if (scrollHeight <= 0) scrollHeight = 1; let fullWindowHeightInPercentage = Math.round((scrollNow / scrollHeight) * 100); let percentage = document.getElementById('percentage'); if (percentage) { if (fullWindowHeightInPercentage == 0) { percentage.innerHTML = ' 到顶啦'; } else if (fullWindowHeightInPercentage >= 100) { percentage.innerHTML = ' 到底啦'; } else { percentage.innerHTML = ' ' + fullWindowHeightInPercentage + '%'; } } }; // 底部滚动文字功能 (function() { var $this = document.getElementById("footgundong"); if (!$this) return; var scrollTimer; $this.addEventListener('mouseenter', function() { clearInterval(scrollTimer); }); $this.addEventListener('mouseleave', function() { scrollTimer = setInterval(function() { scrollNews($this); }, 2000); }); function scrollNews(obj) { var $self = obj.querySelector('ul'); if (!$self) return; var firstLi = $self.querySelector('li:first-child'); if (!firstLi) return; var lineHeight = firstLi.offsetHeight; $self.style.transition = 'margin-top 0.5s'; $self.style.marginTop = -lineHeight + 'px'; setTimeout(function() { $self.style.transition = 'none'; $self.style.marginTop = '0'; $self.appendChild(firstLi); }, 500); } })();