Я разработал страницу, которая содержит много анимаций, и все они хорошо работают в браузерах, таких как Chrome и Firefox, но когда они открываются в Safari (MAC) и Safari (Windows), анимация не отображается.Я не понимаю, в чем именно проблема.
Я добавил HTML, который содержит три анимации animation1, animation2 и animation3.Я только добавил animation2 css.А остальные анимации почти такие же.
Вот HTML: -
$(document).on("scroll", function () {
if (isScrolledIntoView1($elem1, $window1)) {
$elem1.addClass("animate1")
}
});
$(document).on("scroll", function () {
if (isScrolledIntoView($elem, $window)) {
$elem.addClass("animate2")
}
});
$(document).on("scroll", function () {
if (isScrolledIntoView2($elem2, $window2)) {
$elem2.addClass("animate3")
}
});
var $window = $(window);
var $elem = $(".animation2")
function isScrolledIntoView($elem, $window) {
var docViewTop = $window.scrollTop();
var docViewBottom = docViewTop + $window.height();
var elemTop = $elem.offset().top;
var elemBottom = elemTop + $elem.height();
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}
var $window1 = $(window);
var $elem1 = $(".animation1")
function isScrolledIntoView1($elem1, $window1) {
var docViewTop1 = $window1.scrollTop();
var docViewBottom1 = docViewTop1 + $window1.height();
var elemTop1 = $elem1.offset().top;
var elemBottom1 = elemTop1 + $elem1.height();
return ((elemBottom1 <= docViewBottom1) && (elemTop1 >= docViewTop1));
}
var $window2 = $(window);
var $elem2 = $(".animation3")
function isScrolledIntoView2($elem2, $window2) {
var docViewTop2 = $window2.scrollTop();
var docViewBottom2 = docViewTop2 + $window2.height();
var elemTop2 = $elem2.offset().top;
var elemBottom2 = elemTop2 + $elem2.height();
return ((elemBottom2 <= docViewBottom2) && (elemTop2 >= docViewTop2));
}
.animation2.animate2 {
animation-name: pulse2;
animation-duration: 2s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
animation-delay: 0s;
-webkit-animation-name: pulse2;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: 1;
-webkit-animation-fill-mode: forwards;
-webkit-animation-delay: 0s;
}
@keyframes pulse2 {
0% {
position: relative;
top: -500px;
left: 100px;
background-color: #94D6E2;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
width: 750px;
height: 300px;
margin-top: 150px;
z-index: -1;
}
100% {
position: relative;
top: -600px;
left: 100px;
background-color: #94D6E2;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
width: 850px;
height: 400px;
margin-top: 150px;
z-index: -1;
}
}
@-webkit-keyframes pulse2 {
0% {
position: relative;
top: -500px;
left: 100px;
background-color: #94D6E2;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
width: 750px;
height: 300px;
margin-top: 150px;
z-index: -1;
}
100% {
position: relative;
top: -600px;
left: 100px;
background-color: #94D6E2;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
width: 850px;
height: 400px;
margin-top: 150px;
z-index: -1;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="about-slide1">
<div class="animation3" style="background-image: url('img/01.png');"></div>
<div class="animation1">
<div class=" about-slide1-position">
<h3 class="pt-4 about-slide1-title">Custom</h3>
<hr class="about-slide1-hr">
<h5 class="px-5" >Top culinary chefs from across the country have prepared a highly delectable keto menu, comprising of dishes such as Hyderabadi Biryani, Butter Chicken, Thin Crust Pizza, Pasta and Chocolate Mousse amongst others.</h5>
</div>
<div class="tech-slideshow">
<div class="mover-1" style="background-image: url(img/04.png);background-size: cover;"></div>
</div>
</div>
<div class="animation2"></div>
</div>
<div class="animation2"></div>
</div>