Проблемы с js на IOS раньше 7 версии
На IOS меньшей версии чем 7 появляются такие ошибки и не запускается js. Я использую библиотеку AOS.js и, видимо, из-за этих ошибок она не запускается и контент на страницен не появляется.

Js:
document.addEventListener("DOMContentLoaded", function(event) {
//test for getting url value from attr
// var img1 = $('.test').attr("data-thumbnail");
// console.log(img1);
$('.select-flags-wrapper').each(function (key, item) {
var sliderIdName = 'flags' + key;
this.id = sliderIdName;
var sliderId = '#' + sliderIdName;
//test for iterating over child elements
var langArray = [];
$(sliderId+' .vodiapicker option').each(function(){
var img = $(this).attr("data-thumbnail");
var text = this.innerText;
var value = $(this).val();
var item = '<li value="'+value+'"><img src="'+ img +'" alt="" value="'+value+'"/><span>'+ text +'</span></li>';
langArray.push(item);
});
$(sliderId+' .a').html(langArray);
//Set the button value to the first el of the array
$(sliderId+' .btn-select').html(langArray[0]);
$(sliderId+' .btn-select').attr('value', $(sliderId+' .a li').attr('value'));
// $(sliderId+' .vodiapicker')[0].selectedIndex = 0;
// $(sliderId+' .vodiapicker').trigger('change');
//change button stuff on click
$(sliderId+' .a li').click(function(){
var img = $(this).find('img').attr("src");
var value = $(this).find('img').attr('value');
var text = this.innerText;
var item = '<li><img src="'+ img +'" alt="" /><span>'+ text +'</span></li>';
$( sliderId+' .btn-select').html(item);
$( sliderId+' .btn-select').attr('value', value);
$( sliderId+" .b").toggle();
$(sliderId+' .vodiapicker')[0].selectedIndex = $(this).attr('value')
$(sliderId+' .vodiapicker').trigger('change');
//console.log(value);
});
$(sliderId+" .btn-select").click(function(){
$( sliderId+" .b").toggle();
});
//check local storage for the lang
var sessionLang = localStorage.getItem('lang');
if (sessionLang){
//find an item with value of sessionLang
var langIndex = langArray.indexOf(sessionLang);
$(sliderId+' .btn-select').html(langArray[langIndex]);
$(sliderId+' .btn-select').attr('value', sessionLang);
} else {
var langIndex = langArray.indexOf('ch');
$('.btn-select').html(langArray[langIndex]);
//$('.btn-select').attr('value', 'en');
}
});
});
function latestRolesSlider() {
$('.section-slider.section-slider-1 .ss__slider').slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 1,
prevArrow: '.section-slider.section-slider-1 .ss__slider-prev',
nextArrow: '.section-slider.section-slider-1 .ss__slider-next',
adaptiveHeight: true,
responsive: [
{
breakpoint: 1230,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 830,
settings: {
slidesToShow: 1
}
},
]
});
}
jQuery(document).ready(function ($) {
//animation
AOS.init({
duration: 700,
once: true,
startEvent: 'load',
});
// --------------------------------------------------------------------------------------------------------------
$(".menu ul").accordion({
accordion: true,
speed: 300,
closedSign: '',
openedSign: ''
});
//Плавнаяч прокрутка
var linkNav = document.querySelectorAll('[href^="#"]'),
V = 0.3; // скорость, может иметь дробное значение через точку
for (var i = 0; i < linkNav.length; i++) {
linkNav[i].addEventListener('click', function (e) {
e.preventDefault();
var w = window.pageYOffset, // прокрутка
hash = this.href.replace(/[^#]*(.*)/, '$1'); // id элемента, к которому нужно перейти
t = document.querySelector(hash).getBoundingClientRect().top, // отступ от окна браузера до id
start = null;
requestAnimationFrame(step); // подробнее про функцию анимации [developer.mozilla.org]
function step(time) {
if (start === null) start = time;
var progress = time - start,
r = (t < 0 ? Math.max(w - progress / V, w + t) : Math.min(w + progress / V, w + t));
window.scrollTo(0, r);
if (r != w + t) {
requestAnimationFrame(step)
} else {
location.hash = hash // URL с хэшем
}
}
}, false);
}
// --------------------------------------------------------------------------------------------------------------
$(".language__item").click(function () {
$('.language__list').toggle();
});
$(document).on('click', function (e) {
if (!$(e.target).closest(".language").length) {
$('.language__list').hide();
}
e.stopPropagation();
});
// --------------------------------------------------------------------------------------------------------------
$('.globe-block').on('click', '.globe-left ul li:not(.active)', function () {
var tab = $(this).closest('.globe-block');
if ($(this).hasClass('gc-button')) {
var index = $(this).parent().index();
} else {
var index = $(this).index();
}
$('.globe-left ul li, .gc-button, .gc-wrap', tab).removeClass('active');
$('.globe-left ul li', tab).eq(index).addClass('active');
$('.gc-wrap', tab).eq(index).addClass('active');
$('.gc-wrap', tab).eq(index).find('.gc-button').addClass('active');
$('.gc-box', tab).hide();
$('.globe-img', tab).hide();
$('.gc-wrap', tab).eq(index).find('.gc-box').fadeIn(200);
$('.gc-wrap', tab).eq(index).find('.globe-img').fadeIn(200);
});
$('.gc-button').click(function () {
var tab = $(this).parent();
var index = tab.index();
if ($(this).hasClass('active')) return;
$('.gc-box').not($('.gc-box', tab)).slideUp(300, function () {
$('.globe-left ul li, .gc-button, .gc-wrap').removeClass('active');
tab.addClass('active');
$('.gc-button', tab).addClass('active');
$('.gc-box', tab).slideDown();
});
});
$(".globe-left ul li").eq(0).click();
$('.globe-left ul li').hover(function () {
$(this).click();
});
// --------------------------------------------------------------------------------------------------------------
$('.expert-slider').slick({
autoplay: true,
autoplaySpeed: 10000,
infinite: true,
speed: 350,
arrows: true,
dots: false
});
//Меню в мобильной версии
$(".menu-icon").click(function () {
$("#site").addClass('open-menu');
});
$(".close-menu, .mobil-menu-overlay").click(function () {
$("#site").removeClass('open-menu');
});
//select dropdown
var checkLists = document.querySelectorAll('.dropdown-check-list')
checkLists.forEach(checkList => {
checkList.getElementsByClassName('anchor')[0].onclick = function (evt) {
if (checkList.classList.contains('visible'))
checkList.classList.remove('visible');
else
checkList.classList.add('visible');
}
})
//related slider
$('.rs__slider').slick({
infinite: true,
slidesToShow: 2,
arrows: true,
dots: false,
adaptiveHeight: true,
responsive: [
{
breakpoint: 1180,
settings: {
slidesToShow: 1
}
},
]
});
//pop-up
// const team_card = document.querySelectorAll('.team__list .team__card');
// team_card.forEach(item => {
// const pop_ups = document.querySelectorAll('.pop-up');
// item.addEventListener('click', () => {
// const overlay = document.querySelector('.overlay');
// pop_ups.forEach(pop_up => {
// const attribute = item.getAttribute('data-modal');
// pop_up.classList.remove('show');
// if (pop_up.getAttribute('data-modal') === attribute) {
//
// overlay.classList.add('show');
// pop_up.classList.add('show');
// document.body.classList.add('body-fix');
// }
// const pop_up__close = pop_up.querySelector(".pop-up__close");
// pop_up__close.addEventListener('click', () => {
// overlay.classList.remove('show');
// pop_up.classList.remove('show');
// document.body.classList.remove('body-fix');
//
// });
// });
// })
//
// });
const team_card = document.querySelectorAll('.team__list .team__card');
team_card.forEach(item => {
const pop_ups = document.querySelectorAll('.pop-up');
item.addEventListener('click', () => {
// const overlay = document.querySelector('.overlay');
const overlays = document.querySelectorAll('.overlay');
pop_ups.forEach(pop_up => {
const attribute = item.getAttribute('data-modal');
pop_up.classList.remove('show');
if (pop_up.getAttribute('data-modal') === attribute) {
overlays.forEach(over => {
if (over.id === 'overlay_' + attribute) {
over.classList.add('show');
}
});
pop_up.classList.add('show');
document.body.classList.add('body-fix');
}
const pop_up__close = pop_up.querySelector(".pop-up__close");
pop_up__close.addEventListener('click', () => {
overlays.forEach(over => {
if (over.id === 'overlay_' + attribute) {
over.classList.remove('show');
}
});
pop_up.classList.remove('show');
document.body.classList.remove('body-fix');
});
});
})
});
//pop-up end
//slider
//
// $('.section-slider.section-slider-1 .ss__slider').slick({
// infinite: true,
// slidesToShow: 3,
// slidesToScroll: 1,
// prevArrow: '.section-slider.section-slider-1 .ss__slider-prev',
// nextArrow: '.section-slider.section-slider-1 .ss__slider-next',
// adaptiveHeight: true,
// responsive: [
// {
// breakpoint: 1230,
// settings: {
// slidesToShow: 2
// }
// },
// {
// breakpoint: 830,
// settings: {
// slidesToShow: 1
// }
// },
// ]
// });
//
$('.section-slider.section-slider-2 .ss__slider').slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 1,
prevArrow: '.section-slider.section-slider-2 .ss__slider-prev',
nextArrow: '.section-slider.section-slider-2 .ss__slider-next',
adaptiveHeight: true,
responsive: [
{
breakpoint: 1230,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 830,
settings: {
slidesToShow: 1
}
},
]
});
$('.section-slider-3 .ss-3__slider').slick({
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
prevArrow: '.section-slider-3 .ss__slider-prev',
nextArrow: '.section-slider-3 .ss__slider-next',
adaptiveHeight: true,
});
$('.section-slider-4 .ss-4__slider').slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 1,
prevArrow: '.section-slider-4 .ss__slider-prev',
nextArrow: '.section-slider-4 .ss__slider-next',
adaptiveHeight: true,
responsive: [
{
breakpoint: 1230,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 830,
settings: {
slidesToShow: 1
}
},
]
});
//slider end
const news_small = document.querySelectorAll(".news-small li");
news_small.forEach(item => {
const video = item.querySelector("video");
const video_bg = item.querySelector(".video-bg");
item.addEventListener("mouseover", () => {
video_bg.classList.add('active');
video.play();
})
item.addEventListener("mouseleave", () => {
video_bg.classList.remove('active');
video.pause();
})
})
const base_cards = document.querySelectorAll(".base-card__list li");
base_cards.forEach(item => {
const video = item.querySelector("video");
const video_bg = item.querySelector(".video-bg");
item.addEventListener("mouseover", () => {
video_bg.classList.add('active');
video.play();
})
item.addEventListener("mouseleave", () => {
video_bg.classList.remove('active');
video.pause();
})
})
//contacts
const contact_list = document.querySelectorAll('.contact__list li');
contact_list.forEach(item => {
item.addEventListener('click', () => {
item.classList.toggle('active');
})
})
//contacts end
// Анимация сайдбара----------------------------------------------------------------------------------------------------------------
$(window).scroll(function () {
if ($(this).scrollTop() > 1080) {
$('.sliding-strip').addClass('scroll-active');
} else {
$('.sliding-strip').removeClass('scroll-active');
}
});
//why-slider
$('.qna__slider').slick({
infinite: true,
slidesToShow: 1,
arrows: false,
dots: false,
autoplay: true,
});
//fixed-nav
$(window).scroll(function () {
if ($(this).scrollTop() > 1080) {
$('.fixed-nav').addClass('scroll-active').removeClass('fixed-nav_disabled');
} else {
$('.fixed-nav').removeClass('scroll-active');
if ( $('.fixed-nav.fixed-nav_once-static')){
$('.fixed-nav').addClass('fixed-nav_disabled');
}
}
});
const slider = $(".step__list");
slider.slick({
infinite: false,
slidesToShow: 2,
slidesToScroll: 1,
arrows: true,
prevArrow: '.step__list-wrapper .step__list-prev',
nextArrow: '.step__list-wrapper .step__list-next',
dots: false,
// autoplay: true,
// autoplaySpeed: 3000,
responsive: [
{
breakpoint: 768,
settings: {
slidesToShow: 1,
}
}
]
});
//aside choose flags
let country = $('#location-selected').attr('value');
$('#side-menu-country').val(country);
load('page/get_cities', 'country_id=' + country);
$('#aside-menu-locations').on('change', function () {
// get id selected location
let country = $('#location-selected').attr('value');
$('#side-menu-country').val(country);
load('page/get_cities', 'country_id=' + country);
})
//start page choose flags
$('#menu-locations').on('change', function () {
// get id selected location
let country = $('#start-location-selected').attr('value');
$('#menu-country').val(country);
load('page/get_cities', 'country_id=' + country , 'page=start_page');
})
//start page choose flags for microsites
$('#menu-locations-microsite').on('change', function () {
// get id selected location
let country = $('#start-location-selected').attr('value');
$('#menu-country').val(country);
load('page/get_cities_microsite', 'country_id=' + country , 'page=start_page');
})
//выбор флагов
// $('#flags-dropdown').ddslick({
// width: 72,
// imagePosition: "left",
// background: '#FFFFFF',
// onSelected: function(data){
// let selectedValue = data.selectedData.value;
//
// //country input
// $('#country').val(selectedValue);
//
// $('.cities').each(function(){
// $(this).parent().find('input:checkbox').attr('checked', false);
// $(this).css('display', 'none');
// });
//
// $('.city-' + selectedValue).each(function() {
// $(this).css('display', 'block');
// });
//
//
// }
// });
// $('#aside-flags-dropdown').ddslick({
// width: 44,
// imagePosition: "left",
// background: '#FFFFFF',
// onSelected: function(data){
// let selectedValue = data.selectedData.value;
//
// //country input
// $('#side-menu-country').val(selectedValue);
//
// $('.cities').each(function(){
// $(this).parent().find('input:checkbox').attr('checked', false);
// $(this).css('display', 'none');
// });
//
// $('.city-' + selectedValue).each(function() {
// $(this).css('display', 'block');
// });
//
// }
// });
// //event script
const firstCont = document.querySelector('.first__cont')
if (document.querySelector('.event') ){
firstCont.classList.add('first__event')
}
//event script end
// "use strict";
//
// // Класс или тег элемента на которые нужно повесить анимации
//
// const items = document.querySelectorAll('.section-text_stopping');
//
// // Начало перебора всех элементов
//
// items.forEach(item => {
//
// // Функция скролла
//
// function isVisible(tag) {
// var t = $(tag);
// var w = $(window);
// var wt = w.scrollTop();
// var tt = t.offset().top;
// var tb = tt + t.height();
// return ((tb <= wt + w.height() - 0) && (tt >= wt));
// }
//
// // Функция просмотра поля видимости
//
// function signal() {
// var b = $(item);
// if (!b.prop("shown") && isVisible(b)) {
// b.prop("shownfont-size: 20px; cursor:pointer;color: yellow;", true);
// // Добавляет класс для анимации на все нужные элементы
// document.body.classList.add('body-fix')
// const sectionText = $('.section-text_stopping');
// sectionText.on('wheel', (function(e) {
// e.preventDefault();
//
// if (e.originalEvent.deltaY < 0) {
// slider.slick('slickPrev');
// } else {
// slider.slick('slickNext');
// }
// if (document.querySelector('.step__list-wrapper .step__list-next.slick-disabled')){
// document.body.classList.remove('body-fix')
// sectionText.off('wheel')
// // slider.on('wheel', (function(e) {
// // e.preventDefault();
// // if (e.originalEvent.deltaY < 0) {
// // slider.slick('slickPrev');
// // } else {
// // slider.slick('slickNext');
// // }
// // }));
// }
// }));
// }
// }
//
// // Вызов функции во время скролла и загрузки страницы
//
// $(function () {
// signal();
// $(window).scroll(signal);
// });
//
// });
});//конец ready
