0
我有在IE11的问题,该行jQuery是不承认的......:IE11 JS错误常量名=>功能
const applyHeights = (items, height) => {
你有任何想法如何使它工作?这将是真棒!它在其他浏览器如chrome,safari,firefox等上都可以正常工作!
谢谢!
- 编辑 -
作为下面:
let maxHeight = Math.max(...heights);
--all CODE -
setTimeout(function(){
setTimeout(function() {
const applyHeights = function(items, height) {
const applyHeights = function(items, height) {
const applyHeights = function(items, height) {
items.forEach(function(item) {
let back = item.querySelector('.back'),
front = item.querySelector('.front');
back.style.height = height;
front.style.height = height;
item.style.height = height;
});
}
const getHeights =function (items, className) {
return Array.from(items).map(function(item) {
return item.querySelector('.${className}').offsetHeight;
});
}
const initFlip = function(id) {
let element = document.getElementById(id);
if(!element) return;
initHeights(element);
window.onresize = function(event) {
resetHeights(element);
initHeights(element);
}
}
const initHeights = function(element) {
let items = element.querySelectorAll('article'),
backHeights = getHeights(items, 'back'),
frontHeights = getHeights(items, 'front');
let heights = backHeights.concat(frontHeights);
var maxHeight = Math.max(...heights);
applyHeights(items, '${maxHeight}px');
}
const resetHeights = function(element) {
let items = element.querySelectorAll('article');
applyHeights(items, 'auto');
}
这是_Javascript_,而不是jQuery。 – SLaks
IE11不支持ES6。使用转译器。 – SLaks
SLaks,谢谢,这是什么意思? – thibaultlgd