Commit 2f8e8323 by doszhang

dos

parent 0db8de1d
...@@ -66,6 +66,8 @@ let resultType = 8; ...@@ -66,6 +66,8 @@ let resultType = 8;
let submitStatus = true; let submitStatus = true;
//是否已经看过规则 //是否已经看过规则
let checkedRule = false; let checkedRule = false;
//滚动防抖定时器
let timer;
//记录初始状态下fontsize //记录初始状态下fontsize
const fontSize = parseFloat($('html').css('fontSize')); const fontSize = parseFloat($('html').css('fontSize'));
...@@ -160,13 +162,19 @@ $(document).ready(function () { ...@@ -160,13 +162,19 @@ $(document).ready(function () {
function ruleScroll() { function ruleScroll() {
//7.9-46.9 //7.9-46.9
let blockHeight = $('.rule-block').height() / fontSize; //rem if (timer) {
let wrapHeight = 155; //rem clearTimeout(timer);
let scrollHeight = wrapHeight - blockHeight; //rem }
let step = (39 * fontSize) / (scrollHeight * fontSize); timer = setTimeout(() => {
let blockHeight = $('.rule-block').height() / fontSize; //rem
let wrapHeight = 155; //rem
let scrollHeight = wrapHeight - blockHeight; //rem
let step = (39 * fontSize) / (scrollHeight * fontSize);
let scrollTop = $('.rule-block').scrollTop();
$('.scroll-bar').css('top', (7.9 * fontSize) + scrollTop * step + 'px');
}, 5);
let scrollTop = $('.rule-block').scrollTop();
$('.scroll-bar').css('top', (7.9 * fontSize) + scrollTop * step + 'px');
} }
function hideRule() { function hideRule() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment