testing
This commit is contained in:
parent
c4fb1bafec
commit
0af61db7f2
|
@ -1,115 +1,24 @@
|
||||||
.content {
|
/* Style for the container of the carousel */
|
||||||
overflow:hidden;
|
.carousel-container {
|
||||||
|
width: 70px;
|
||||||
&__container {
|
height: 15px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
&:before {
|
|
||||||
content: '[';
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:after {
|
|
||||||
content: ']';
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:after, &:before {
|
|
||||||
top: 0;
|
|
||||||
-webkit-animation-name: opacity;
|
|
||||||
-webkit-animation-duration: 2s;
|
|
||||||
-webkit-animation-iteration-count: infinite;
|
|
||||||
animation-name: opacity;
|
|
||||||
animation-duration: 2s;
|
|
||||||
animation-iteration-count: infinite;
|
|
||||||
}
|
|
||||||
&__list {
|
|
||||||
-webkit-animation-name: change;
|
|
||||||
-webkit-animation-duration: 10s;
|
|
||||||
-webkit-animation-iteration-count: infinite;
|
|
||||||
animation-name: change;
|
|
||||||
animation-duration: 10s;
|
|
||||||
animation-iteration-count: infinite;
|
|
||||||
|
|
||||||
&__item {
|
|
||||||
line-height:40px;
|
|
||||||
margin:0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes opacity {
|
/* Style for the list inside the carousel */
|
||||||
0%, 100% {opacity:0;}
|
.carousel-list {
|
||||||
50% {opacity:1;}
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
transition: top 0.5s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes change {
|
/* Style for individual items in the carousel */
|
||||||
0%, 12.66%, 100% {transform:translate3d(0,0,0);}
|
.carousel-item {
|
||||||
16.66%, 29.32% {transform:translate3d(0,-25%,0);}
|
height: 15px; /* Adjust height as needed */
|
||||||
33.32%,45.98% {transform:translate3d(0,-50%,0);}
|
line-height: 15px; /* Adjust line-height to vertically center text */
|
||||||
49.98%,62.64% {transform:translate3d(0,-75%,0);}
|
/*border-bottom: 1px solid #ccc; /* Optional: Add border between items */
|
||||||
66.64%,79.3% {transform:translate3d(0,-50%,0);}
|
|
||||||
83.3%,95.96% {transform:translate3d(0,-25%,0);}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@-o-keyframes opacity {
|
|
||||||
0%, 100% {opacity:0;}
|
|
||||||
50% {opacity:1;}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-o-keyframes change {
|
|
||||||
0%, 12.66%, 100% {transform:translate3d(0,0,0);}
|
|
||||||
16.66%, 29.32% {transform:translate3d(0,-25%,0);}
|
|
||||||
33.32%,45.98% {transform:translate3d(0,-50%,0);}
|
|
||||||
49.98%,62.64% {transform:translate3d(0,-75%,0);}
|
|
||||||
66.64%,79.3% {transform:translate3d(0,-50%,0);}
|
|
||||||
83.3%,95.96% {transform:translate3d(0,-25%,0);}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-keyframes opacity {
|
|
||||||
0%, 100% {opacity:0;}
|
|
||||||
50% {opacity:1;}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-keyframes change {
|
|
||||||
0%, 12.66%, 100% {transform:translate3d(0,0,0);}
|
|
||||||
16.66%, 29.32% {transform:translate3d(0,-25%,0);}
|
|
||||||
33.32%,45.98% {transform:translate3d(0,-50%,0);}
|
|
||||||
49.98%,62.64% {transform:translate3d(0,-75%,0);}
|
|
||||||
66.64%,79.3% {transform:translate3d(0,-50%,0);}
|
|
||||||
83.3%,95.96% {transform:translate3d(0,-25%,0);}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes opacity {
|
|
||||||
0%, 100% {opacity:0;}
|
|
||||||
50% {opacity:1;}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes change {
|
|
||||||
0%, 12.66%, 100% {transform:translate3d(0,0,0);}
|
|
||||||
16.66%, 29.32% {transform:translate3d(0,-25%,0);}
|
|
||||||
33.32%,45.98% {transform:translate3d(0,-50%,0);}
|
|
||||||
49.98%,62.64% {transform:translate3d(0,-75%,0);}
|
|
||||||
66.64%,79.3% {transform:translate3d(0,-50%,0);}
|
|
||||||
83.3%,95.96% {transform:translate3d(0,-25%,0);}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 6 is the number of animation.
|
|
||||||
// Here, there are 4 lines :
|
|
||||||
|
|
||||||
// 1 to 2
|
|
||||||
// 2 to 3
|
|
||||||
// 3 to 4
|
|
||||||
// 4 to 3
|
|
||||||
// 3 to 2
|
|
||||||
// 2 to 1
|
|
||||||
|
|
||||||
// 6x + 6y = 100 (100% duration)
|
|
||||||
|
|
||||||
// HERE :
|
|
||||||
// y = 4 -> Animation between two lines
|
|
||||||
// x = 12.66 -> Time spent on a line
|
|
||||||
|
|
||||||
// You can define a value and calculate the other if you want change speed or the number of lines
|
|
17
static/scroll.js
Normal file
17
static/scroll.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
const carouselList = document.getElementById('carouselList');
|
||||||
|
const items = carouselList.getElementsByClassName('carousel-item');
|
||||||
|
const itemHeight = items[0].offsetHeight;
|
||||||
|
const totalItems = items.length;
|
||||||
|
let currentIndex = 0;
|
||||||
|
|
||||||
|
function scrollCarousel() {
|
||||||
|
currentIndex++;
|
||||||
|
if (currentIndex === totalItems) {
|
||||||
|
currentIndex = 0;
|
||||||
|
}
|
||||||
|
const displacement = -currentIndex * itemHeight;
|
||||||
|
carouselList.style.top = displacement + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set interval for autoscrolling (adjust timing as needed)
|
||||||
|
const scrollInterval = setInterval(scrollCarousel, 2000);
|
|
@ -42,14 +42,12 @@
|
||||||
<tr class="bg-gray-100 border-b">
|
<tr class="bg-gray-100 border-b">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap">
|
<td class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap">
|
||||||
<div class="content">
|
<div class="carousel-container">
|
||||||
<div class="content__container">
|
<ul class="carousel-list" id="carouselList">
|
||||||
<ul class="content__container__list">
|
{% for ident in flight[i]["ident"] %}
|
||||||
{% for ident in flight[i]["ident"] %}
|
<li class="carousel-item">{{ ident }}</li>
|
||||||
<li class="content__container__list__item">{{ ident }}</li>
|
{% endfor %}
|
||||||
{% endfor %}
|
</ul>
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap">{{ flight[i]["scheduled_off"] }}</td>
|
<td class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap">{{ flight[i]["scheduled_off"] }}</td>
|
||||||
|
@ -87,5 +85,6 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="/static/scroll.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue