diff options
author | Dillon <dillonzq@outlook.com> | 2020-04-30 18:21:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-30 18:21:52 +0300 |
commit | 3040ffa107eccd45416a5b9c5f3b85fdd50d94d8 (patch) | |
tree | d2ce33130c7929cd1a0a571f09f16a8cd35b8a96 /src/js | |
parent | 3096ff623597d3af9a9c65525405b858ad547e7a (diff) |
feat: improve browser compatibility for TypeIt and object-fit (#293)
* object-fit polyfill
* TypeIt 7.0.3 -> 6.5.1
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/theme.js | 10 |
1 files changed, 3 insertions, 7 deletions
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() { |