From 3040ffa107eccd45416a5b9c5f3b85fdd50d94d8 Mon Sep 17 00:00:00 2001 From: Dillon Date: Thu, 30 Apr 2020 23:21:52 +0800 Subject: feat: improve browser compatibility for TypeIt and object-fit (#293) * object-fit polyfill * TypeIt 7.0.3 -> 6.5.1 --- src/js/theme.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/js/theme.js b/src/js/theme.js index 017c253..51628a6 100644 --- a/src/js/theme.js +++ b/src/js/theme.js @@ -40,6 +40,7 @@ class Theme { this.resizeEventSet = new Set(); this.switchThemeEventSet = new Set(); this.clickMaskEventSet = new Set(); + if (objectFitImages) objectFitImages(); } initSVGIcon() { @@ -56,7 +57,7 @@ class Theme { if ($titleElements.length) $svg.removeChild($titleElements[0]); $icon.parentElement.replaceChild($svg, $icon); }) - .catch(console.error.bind(console)); + .catch(err => { console.error(err); }); }); } @@ -586,12 +587,7 @@ class Theme { } initSmoothScroll() { - if ((!this.util.isMobile() && this.config.headerMode.desktop === 'normal') - || (this.util.isMobile() && this.config.headerMode.mobile === 'normal')) { - new SmoothScroll('[href^="#"]', {speed: 300, speedAsDuration: true}); - } else { - new SmoothScroll('[href^="#"]', {speed: 300, speedAsDuration: true, header: '#header-desktop'}); - } + if (SmoothScroll) new SmoothScroll('[href^="#"]', { speed: 300, speedAsDuration: true, header: '#header-desktop' }); } onScroll() { -- cgit v1.2.3