0

我在使用一些用于网站的 Javascript 时遇到问题。目的是根据特定 div 在屏幕上的外观使标题元素 css 发生变化。实际上它在桌面上完美运行!但不是在 Iphone 上...我无法弄清楚它有什么问题...您能帮我理解一下吗?谢谢很多!

var isInViewport = function (elem) {
    var bounding = elem.getBoundingClientRect();
    return (
        bounding.top >= 0 &&
        bounding.left >= 0 &&
        bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
        bounding.right <= (window.innerWidth || document.documentElement.clientWidth)
    );
};
var section_clouds = document.querySelector('#section_intro_clouds');
window.addEventListener('transitionend', function (event) {
    if (isInViewport(section_clouds)) {
        document.getElementById('header_blanc').classList.add('colorer_bleu');}
else {document.getElementById('header_blanc').classList.remove('colorer_bleu');}
}, false);
4

0 回答 0