mirror of
https://github.com/istiyakaminsanto/tailShape.git
synced 2025-12-23 14:37:02 +00:00
119 lines
4.8 KiB
HTML
119 lines
4.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" class="dark">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="./../../../dist/tailshape.css">
|
|
<link rel="stylesheet" href="https://demos.creative-tim.com/notus-js/assets/vendor/@fortawesome/fontawesome-free/css/all.min.css">
|
|
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
|
|
<title>Slider 2</title>
|
|
</head>
|
|
<body>
|
|
|
|
<button class="dark_mode_button_custom_style" id="dark_mood_toogler">
|
|
d
|
|
</button>
|
|
|
|
|
|
<!-- slider 2 start -->
|
|
<section class="section_divider">
|
|
<div>Slider 2</div>
|
|
</section>
|
|
|
|
<main class="w-full min-h-screen grid place-content-center bg-gray-900">
|
|
|
|
<div x-data="imageSlider" class="bg-gray-100 rounded-md max-w-2xl mx-auto relative p-2 sm:p-4 overflow-hidden">
|
|
|
|
<div class="rounded-full bg-gray-600 text-white absolute top-5 right-5 text-sm px-2 text-center z-10">
|
|
<span x-text="currentIndex"></span>/<span x-text="images.length"></span>
|
|
</div>
|
|
|
|
<button @click="previous()"
|
|
class="absolute left-5 top-1/2 -translate-y-1/2 bg-gray-100 rounded-full w-11 h-11 flex justify-center items-center shadow-md z-10">
|
|
<svg class="w-8 h-8 font-bold text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"
|
|
xmlns="http://www.w3.org/2000/svg">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M15 19l-7-7 7-7">
|
|
</path>
|
|
</svg>
|
|
</button>
|
|
|
|
<button @click="forward()"
|
|
class="absolute right-5 top-1/2 -translate-y-1/2 bg-gray-100 rounded-full w-11 h-11 flex justify-center items-center shadow-md z-10">
|
|
<svg class="w-8 h-8 font-bold text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"
|
|
xmlns="http://www.w3.org/2000/svg">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M9 5l7 7-7 7"></path>
|
|
</svg>
|
|
</button>
|
|
|
|
<div class="relative h-80" style="width: 30rem;">
|
|
<template x-for="(image, index) in images">
|
|
<div x-show="currentIndex == index + 1" x-transition:enter="transition transform duration-300"
|
|
x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100"
|
|
x-transition:leave="transition transform duration-300" x-transition:leave-start="opacity-100"
|
|
x-transition:leave-end="opacity-0" class="absolute top-0">
|
|
<img :src="image" alt="image" class="rounded-sm">
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<script>
|
|
document.addEventListener('alpine:init', () => {
|
|
Alpine.data('imageSlider', () => ({
|
|
currentIndex: 1,
|
|
images: [
|
|
'https://unsplash.it/640/425?image=30',
|
|
'https://unsplash.it/640/425?image=40',
|
|
'https://unsplash.it/640/425?image=50'
|
|
],
|
|
|
|
previous() {
|
|
if (this.currentIndex > 1 ) {
|
|
this.currentIndex = this.currentIndex - 1;
|
|
}
|
|
|
|
},
|
|
forward() {
|
|
if (this.currentIndex < this.images.length) {
|
|
this.currentIndex = this.currentIndex + 1;
|
|
}
|
|
}
|
|
}))
|
|
})
|
|
</script>
|
|
|
|
<!-- slider 2 end -->
|
|
|
|
|
|
|
|
|
|
<!-- start of script section -->
|
|
<script type="text/javascript">
|
|
let toogler = document.getElementById("dark_mood_toogler");
|
|
let doc_html_el = document.getElementsByTagName('html')[0];
|
|
|
|
doc_html_el.addEventListener('keyup',(e)=>{
|
|
// key 220 is the backward slash , need to press ctrl+ \ to activate or deactivate darkmode
|
|
if(e.ctrlKey && e.keyCode =='220'){
|
|
doc_html_el.className =='' ? doc_html_el.classList.add('dark'):doc_html_el.classList.remove('dark');
|
|
|
|
}
|
|
})
|
|
doc_html_el.addEventListener('keyup',(e)=>{
|
|
// key 191 is the forward slash , need to press ctrl+ / to show or hide the darkmode button
|
|
if(e.ctrlKey && e.keyCode =='191'){
|
|
toogler.style.display =='block'? toogler.style.display = 'none':toogler.style.display ='block';
|
|
|
|
}
|
|
})
|
|
toogler.addEventListener('click',()=>{
|
|
doc_html_el.className =='' ? doc_html_el.classList.add('dark'):doc_html_el.classList.remove('dark');
|
|
console.log(doc_html_el.className);
|
|
})
|
|
</script>
|
|
<!-- end of script section -->
|
|
|
|
</body>
|
|
</html> |