first commit
This commit is contained in:
236
wp-content/themes/hello-elementor/page-1015.php
Normal file
236
wp-content/themes/hello-elementor/page-1015.php
Normal file
@@ -0,0 +1,236 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="uk">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Анімація з пагінацією</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background-color: black;
|
||||
color: yellow;
|
||||
font-family: Arial, sans-serif;
|
||||
perspective: 600px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.scene {
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
height: 80vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
perspective-origin: center top;
|
||||
max-width: 1200px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.text-block {
|
||||
position: absolute;
|
||||
font-size: 2em;
|
||||
transform-origin: center top;
|
||||
text-align: center;
|
||||
opacity: 0;
|
||||
transform: scale(2);
|
||||
transition: transform 1s ease, opacity 1s ease;
|
||||
width: 100%;
|
||||
}
|
||||
.text-block .text-block--wrapper {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.text-block:nth-child(2n) .text-block--wrapper {
|
||||
margin-left: auto;
|
||||
}
|
||||
.text-block:nth-child(2n + 1) .text-block--wrapper {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.enter {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
.exit {
|
||||
transform: scale(0.5) translateZ(-400px);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.column {
|
||||
display: inline-block;
|
||||
width: 45%;
|
||||
text-align: left;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.year {
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.description {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.controls {
|
||||
position: relative;
|
||||
margin-top: 20px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 10px 20px;
|
||||
background-color: yellow;
|
||||
color: black;
|
||||
border: none;
|
||||
font-size: 1em;
|
||||
cursor: pointer;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.button:disabled {
|
||||
background-color: grey;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
list-style-type: none;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 0;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.pagination li {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-color: grey;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.pagination li.active {
|
||||
background-color: yellow;
|
||||
}
|
||||
</style>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="scene">
|
||||
<div class="text-block" id="text1">
|
||||
<div class="text-block--wrapper">
|
||||
<div class="column year">1990</div>
|
||||
<div class="column description">
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda
|
||||
iusto minus veniam hic doloremque laboriosam!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-block" id="text2">
|
||||
<div class="text-block--wrapper">
|
||||
<div class="column year">2005</div>
|
||||
<div class="column description">
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci
|
||||
nisi reprehenderit laudantium, dolorum soluta, a voluptatibus quasi
|
||||
vitae illum error sapiente alias aspernatur reiciendis veniam ipsa
|
||||
dolore possimus. Tenetur, inventore.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-block" id="text3">
|
||||
<div class="text-block--wrapper">
|
||||
<div class="column year">2020</div>
|
||||
<div class="column description">
|
||||
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Voluptate,
|
||||
vero? Cum totam molestiae exercitationem laudantium quidem voluptate
|
||||
in, consequatur eius?
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-block" id="text4">
|
||||
<div class="text-block--wrapper">
|
||||
<div class="column year">2045</div>
|
||||
<div class="column description">
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci
|
||||
nisi reprehenderit laudantium, dolorum soluta, a voluptatibus quasi
|
||||
vitae illum error sapiente alias aspernatur reiciendis veniam ipsa
|
||||
dolore possimus. Tenetur, inventore.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="controls">
|
||||
<button class="button" id="prevBtn" disabled>Poprzedni</button>
|
||||
<button class="button" id="nextBtn">Następny</button>
|
||||
</div>
|
||||
|
||||
<!-- Пагінація -->
|
||||
<ul class="pagination">
|
||||
<li data-index="0" class="active"></li>
|
||||
<li data-index="1"></li>
|
||||
<li data-index="2"></li>
|
||||
<li data-index="3"></li>
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
let currentIndex = 0;
|
||||
const textBlocks = $('.text-block');
|
||||
|
||||
function showSlide(index) {
|
||||
$(textBlocks[currentIndex]).removeClass('enter').addClass('exit');
|
||||
|
||||
setTimeout(() => {
|
||||
$(textBlocks[currentIndex]).removeClass('exit');
|
||||
currentIndex = index;
|
||||
|
||||
$(textBlocks[currentIndex]).addClass('enter');
|
||||
|
||||
updateButtons();
|
||||
updatePagination();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function updateButtons() {
|
||||
$('#prevBtn').prop('disabled', currentIndex === 0);
|
||||
$('#nextBtn').prop('disabled', currentIndex === textBlocks.length - 1);
|
||||
}
|
||||
|
||||
function updatePagination() {
|
||||
$('.pagination li').removeClass('active');
|
||||
$(`.pagination li[data-index="${currentIndex}"]`).addClass('active');
|
||||
}
|
||||
|
||||
$(textBlocks[currentIndex]).addClass('enter');
|
||||
|
||||
$('#nextBtn').click(function () {
|
||||
if (currentIndex < textBlocks.length - 1) {
|
||||
showSlide(currentIndex + 1);
|
||||
}
|
||||
});
|
||||
|
||||
$('#prevBtn').click(function () {
|
||||
if (currentIndex > 0) {
|
||||
showSlide(currentIndex - 1);
|
||||
}
|
||||
});
|
||||
|
||||
$('.pagination li').click(function () {
|
||||
const index = $(this).data('index');
|
||||
if (index !== currentIndex) {
|
||||
showSlide(index);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user