From 68368c0bc57e60229ef44222bff48ccd9f737527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E6=81=92?= <2323333339@qq.com> Date: Fri, 22 Jan 2021 13:28:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/joe.global.js | 3 +-- assets/js/joe.scroll.js | 1 + public/include.php | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 assets/js/joe.scroll.js diff --git a/assets/js/joe.global.js b/assets/js/joe.global.js index 554548a..01a3679 100644 --- a/assets/js/joe.global.js +++ b/assets/js/joe.global.js @@ -1,7 +1,6 @@ window.Joe = function () { /* 请求基准URL */ const BASE_API = '/index.php/joe/api'; - /* 头部高度 */ const Header_Height = $('.joe_header').height(); @@ -224,7 +223,7 @@ window.Joe = function () { length = $('.joe_index__list .joe_list .joe_list__item').length - length; const queryElement = `.joe_index__list .joe_list .joe_list__item:nth-child(${length})`; const offset = $(queryElement).offset().top - Header_Height; - window.scroll({ top: offset - 15, behavior: 'smooth' }); + window.scrollTo({ top: offset - 15, behavior: 'smooth' }); }); } diff --git a/assets/js/joe.scroll.js b/assets/js/joe.scroll.js new file mode 100644 index 0000000..1bb0248 --- /dev/null +++ b/assets/js/joe.scroll.js @@ -0,0 +1 @@ +"use strict";function polyfill(){function o(o){var t=["MSIE ","Trident/","Edge/"];return new RegExp(t.join("|")).test(o)}function t(o,t){this.scrollLeft=o,this.scrollTop=t}function e(o){return.5*(1-Math.cos(Math.PI*o))}function l(o){if(null===o||"object"!=typeof o||void 0===o.behavior||"auto"===o.behavior||"instant"===o.behavior)return!0;if("object"==typeof o&&"smooth"===o.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+o.behavior+" is not a valid value for enumeration ScrollBehavior.")}function r(o,t){return"Y"===t?o.clientHeight+b1?1:n,t=e(n),l=o.startX+(o.x-o.startX)*t,r=o.startY+(o.y-o.startY)*t,o.method.call(o.scrollable,l,r),l===o.x&&r===o.y||u.requestAnimationFrame(s.bind(u,o))}function a(o,e,l){var r,i,n,c,a=y();o===m.body?(r=u,i=u.scrollX||u.pageXOffset,n=u.scrollY||u.pageYOffset,c=w.scroll):(r=o,i=o.scrollLeft,n=o.scrollTop,c=t),s({scrollable:r,method:c,startTime:a,startX:i,startY:n,x:e,y:l})}for(var f=0,p=["ms","moz","webkit","o"],d=0;d + - \ No newline at end of file + + \ No newline at end of file