Почему такой код не работает в Internet Explorer11?
var anchors = $('a[href*="#product"]');
for (var anchor of anchors) {
$(anchor).click(function(evt) {
evt.preventDefault();
const blockID = $(anchor).attr('href').substr(8);
const headerHeight = $("header.page-header").height();
const elemCoord = $("#product"+blockID).offset().top;
const trueCoord = elemCoord - headerHeight;
$("html, body").animate({scrollTop: trueCoord+"px"}, 800);
});
}
var sections3 = $('section[id*="product"]'),
nav3 = $('.pagination-container > ol'),
header3 = $('header.page-header'),
nav_height3 = header3.outerHeight();
$(window).on('scroll', function () {
var cur_pos = $(this).scrollTop();
sections3.each(function() {
var top = $(this).offset().top - nav_height3,
bottom = top + $(this).outerHeight();
var currentId = $(this).attr('id');
if (cur_pos >= top) {
nav3.find('li').removeClass('active');
sections3.removeClass('active');
$(this).addClass('active');
nav3.find('a[href="#'+currentId+'"]').parent('li').addClass('active');
}
});
});