Итак, я недавно начал изучать HTML
и CSS
, и я считаю, что дошел до точки, в которой я относительно хорош в этом, и поэтому я попытался создать свой собственный веб-сайт в качестве практики. Не было проблем ни с чем (кроме, может быть, мобильной реакции, но это уже другой вопрос). В любом случае, я хотел создать своего рода фон для слайд-шоу с примерно 6 изображениями и плавно переключаться каждые 6 секунд. Друг помог мне с этим, так как он выходит из моей лиги с точки зрения @keyframes
(после прочтения я нашел его понятным, но не думаю, что я бы понял это сам). Итак, веб-сайт, который я разрабатываю, написан на иврите (язык направления RTL), поэтому я сделал <html dir="rtl"
, как это сделал бы любой нормальный человек, но когда я попробовал мобильную адаптивность после того, как только узнал о том, насколько сложно это может быть настроить, Я проверил это и увидел, что фон глючит. Я пробовал много разных способов определить проблему, и после нескольких часов попыток найти проблему я обнаружил, что проблема заключается в RTL в html. Однако, учитывая, что это веб-сайт, который является RTL и уже содержит элементы, позиционированные для RTL, это может все испортить. Итак, вот где я прихожу к вам. Есть ли способ решить эту проблему? Сделать это RTL? Я попытался добавить направление к нескольким элементам CSS
, но ничего не получилось.
/* CSS codes */
/* this is there to show no fading animation when you load the page for the first time */
.background-start{
background-image: url(slideshow/slideshow1.jpg);
position: fixed;
background-attachment: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
}
.slideshow,
.slideshow:after {
position: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
z-index: 0;
}
.slideshow li span {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
color: transparent;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
background-attachment: fixed;
opacity: 0;
z-index: 0;
-webkit-animation: imageAnimation 24s linear infinite 0s;
-moz-animation: imageAnimation 24s linear infinite 0s;
-o-animation: imageAnimation 24s linear infinite 0s;
-ms-animation: imageAnimation 24s linear infinite 0s;
animation: imageAnimation 36s linear infinite 0s;
}
.slideshow li:nth-child(1) span {
background-image: url(slideshow/slideshow1.jpg);
}
.slideshow li:nth-child(2) span {
background-image: url(slideshow/slideshow2.jpg);
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
.slideshow li:nth-child(3) span {
background-image: url(slideshow/slideshow3.jpg);
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
}
.slideshow li:nth-child(4) span {
background-image: url(slideshow/slideshow4.jpg);
-webkit-animation-delay: 18s;
-moz-animation-delay: 18s;
-o-animation-delay: 18s;
-ms-animation-delay: 18s;
animation-delay: 18s;
}
.slideshow li:nth-child(5) span {
background-image: url(slideshow/slideshow5.jpg);
-webkit-animation-delay: 24s;
-moz-animation-delay: 24s;
-o-animation-delay: 24s;
-ms-animation-delay: 24s;
animation-delay: 24s;
}
.slideshow li:nth-child(6) span {
background-image: url(slideshow/slideshow6.jpg);
-webkit-animation-delay: 30s;
-moz-animation-delay: 30s;
-o-animation-delay: 30s;
-ms-animation-delay: 30s;
animation-delay: 30s;
}
/* Animation for the slideshow images */
@-webkit-keyframes imageAnimation {
0% { opacity: 0;
-webkit-animation-timing-function: ease-in; }
8% { opacity: 1;
-webkit-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
@-moz-keyframes imageAnimation {
0% { opacity: 0;
-moz-animation-timing-function: ease-in; }
8% { opacity: 1;
-moz-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
@-o-keyframes imageAnimation {
0% { opacity: 0;
-o-animation-timing-function: ease-in; }
8% { opacity: 1;
-o-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
@-ms-keyframes imageAnimation {
0% { opacity: 0;
-ms-animation-timing-function: ease-in; }
8% { opacity: 1;
-ms-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
@keyframes imageAnimation {
0% { opacity: 0;
animation-timing-function: ease-in; }
8% { opacity: 1;
animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
.image_container
{
position: relative;
height: 100vh;
z-index: -1;
}
<!-- HTML codes -->
<div class="image_container">
<div id="background-preload" class="background-start"></div>
<script>$('#background-preload').delay(5000).fadeOut('slow');</script>
<ul class="slideshow">
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
</ul>
</div>
Извините, если кода недостаточно, я просто полагаю, что отправляю весь документ HTML и CSS было бы бесполезно, так как он очень длинный и не имеет к этому никакого отношения.
Спасибо!