feat: improve browser compatibility for TypeIt and object-fit (#293)

* object-fit polyfill
* TypeIt 7.0.3 -> 6.5.1
This commit is contained in:
Dillon
2020-04-30 23:21:52 +08:00
committed by GitHub
parent 3096ff6235
commit 3040ffa107
27 changed files with 65 additions and 31 deletions

View File

@@ -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() {