Skip to content

Instantly share code, notes, and snippets.

@ibrahim-kardi
Created January 18, 2024 17:22
Show Gist options
  • Save ibrahim-kardi/961c7ddc0429cee0bcf1854ee6a6c536 to your computer and use it in GitHub Desktop.
Save ibrahim-kardi/961c7ddc0429cee0bcf1854ee6a6c536 to your computer and use it in GitHub Desktop.
slick 3 slider smooth
<div class="slider">
<div>
<div class="text">
This is the worst kind of discrimination: the kind against me! You don't know how to do any of those. You are the last hope of the universe. Yes, except the Dave Matthews Band doesn't rock.
</div>
</div>
<div>
<div class="text">
This is the worst kind of discrimination: the kind against me! You don't know how to do any of those. You are the last hope of the universe. Yes, except the Dave Matthews Band doesn't rock.
</div>
</div>
<div>
<div class="text">
This is the worst kind of discrimination: the kind against me! You don't know how to do any of those. You are the last hope of the universe. Yes, except the Dave Matthews Band doesn't rock.
</div>
</div>
<div>
<div class="text">
Now that the, uh, garbage ball is in space, Doctor, perhaps you can help me with my sexual inhibitions? As an interesting side note, as a head without a body, I envy the dead. So I really am important? How I feel when I'm drunk is correct?
</div>
</div>
<div>
<div class="text">
I love you, buddy! Leela, are you alright? You got wanged on the head. There, now he's trapped in a book I wrote: a crummy world of plot holes and spelling errors! There's one way and only one way to determine if an animal is intelligent. Dissect its brain!
</div>
</div>
</div>
<style>
body {
background-color: #000;
}
.slider {
background-color: #ccc;
width: 800px;
margin: 0 auto;
}
.text {
/* width: 70%; */
}
.slick-slide {
display: flex;
align-items: center;
justify-content: center;
padding: 30px 0;
opacity: 0;
transition: opacity 1.25s ease-out;
}
.slick-slide.slick-current.slick-center {
opacity: 1;
}
.slick-slide {
opacity: .5;
transition: opacity .5s ease-in-out;
}
div.slick-current {
opacity: 1;
transition: opacity .5s ease-in-out;
}
div.slick-active{
opacity: 1;
transition: opacity .5s ease-in-out;
}
</style>
<script>
$(document).ready(function(){
$('.slider').slick({
dots: false,
infinite: true,
speed: 2000,
slidesToShow: 3,
slidesToScroll: 3,
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment