I want to make a vertical slider with pictures that works automatically. My problem is that when the animation is playing, the transition is very hard from the last picture to the first. I want to implement so that it is continuous like in the picture for example
Can this be done with just css? If not, then how to do it in React, I searched and didn't find useful information on how to implement it in React.
There are npm modules for React to do this? (swiper, elastic-carousel, react-image-gallery)
<div class="slider">
<ul class="slider__line">
<li class="slide__box"><img src='vp1.jpg' alt=""></li>
<li class="slide__box"><img src='vp2.jpg' alt=""></li>
<li class="slide__box"><img src='vp3.jpg' alt=""></li>
<li class="slide__box"><img src='vp4.jpg' alt=""></li>
<li class="slide__box"><img src='vp5.jpg' alt=""></li>
<li class="slide__box"><img src='vp6.jpg' alt=""></li>
</ul>
</div>
styles
.slider {
height: 500px;
overflow: hidden;
}
.slider__line {
list-style: none;
row-gap: 4px;
position: relative;
animation: sld 5s infinite;
transform: translateY(0%);
transition: all 0.5s ease;
}
.slide__box {
border-radius: 5px;
}
.slide__box img {
height: 100%;
height: 100%;
border-radius: 10px;
}
#keyframes sld {
from {
transform: translateY(0%);
}
to {
transform: translateY(-60%);
}
}
Thank you
Related
I have an element on the page with horizontally scrolled content, scrollbar across the top.
This is working in FF/Chrome, and partially working in Safari.
The issue in Safari is the scroll bar is present & functional, but not visible. In the jsfiddle in Safari you can click and scroll across the top, even though no scrollbar shows.
jsfiddle
.testOne {
transform: rotateX(180deg);
overflow-x: scroll;
scrollbar-color: #ffde00 #f7f7f7;
}
.testOne::-webkit-scrollbar {
height: 20px;
}
.testOne::-webkit-scrollbar-thumb {
background-color: #ffde00;
}
.testTwo {
transform: rotateX(180deg);
width: 100%;
display: flex;
visibility: visible;
}
.item {
padding-right: 10px;
list-style: none;
}
<ul class="testContainer">
<span class="testOne">
<span class="testTwo">
<li class="item">
<img src='http://dummyimage.com/255x255/f0f0f0/000000' alt='' title=''/>
</li>
<li class="item">
<img src='http://dummyimage.com/255x255/f0f0f0/000000' alt='' title=''/>
</li>
<li class="item">
<img src='http://dummyimage.com/255x255/f0f0f0/000000' alt='' title=''/>
</li>
</span>
</span>
</ul>
Hoping someone has run into this and can advise a way to show the scrollbar.
When you have transforms on direct child elements it's having the issue. Try moving the transform up one level to the .testContainer element.
.testContainer {
width: 100%;
display: flex;
flex-direction: row;
margin: 0;
padding: 0;
position: relative;
overflow-x: hidden;
transform: rotateX(180deg);
}
.testOne {
overflow-x: scroll;
}
.testOne::-webkit-scrollbar {
height: 20px;
}
.testOne::-webkit-scrollbar-thumb {
background-color: #ffde00;
}
.testTwo {
transform: rotateX(180deg);
width: 100%;
display: flex;
visibility: visible;
}
.item {
padding-right: 10px;
list-style: none;
}
<ul class="testContainer">
<span class="testOne">
<span class="testTwo">
<li class="item">
<img src='http://dummyimage.com/255x255/f0f0f0/000000' alt='' title=''/>
</li>
<li class="item">
<img src='http://dummyimage.com/255x255/f0f0f0/000000' alt='' title=''/>
</li>
<li class="item">
<img src='http://dummyimage.com/255x255/f0f0f0/000000' alt='' title=''/>
</li>
</span>
</span>
</ul>
I want to apply CSS move transition to element with transform property.
Before transition:
<ul class="list">
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
After transition:
<ul class="list">
<li>two</li>
<li>three</li>
<li>one</li>
</ul>
CSS:
.list > li {
transform: skewX(15deg);
transform-origin: bottom left;
}
I tried to apply transition: transform 1s, then skewX was also reset and re-applied.
Example video here: https://youtu.be/n3qC3uny5uM
How can I apply transition to only movement, not shape transform?
You can do something like following using CSS Animation.
.container {
background: #f7f8f9;
display: flex;
}
.container div {
width: 40px;
height: 100px;
background: #fcc700;
margin: 0 4px;
animation: spin linear 1.2s;
// animation: spin linear 1s infinite;
}
#keyframes spin {
from {
transform: translateX(-50px);
}
to {
transform: translateX(50px) skewX(-15deg);
}
}
<div class="container">
<div>A</div>
<div>B</div>
</div>
I have tried to change the hover to click
and search online already
but it still does not work
how can i change the code to onclick
so i can click and show the drop down menu?
The pattern
$* {
box-sizing: border-box;
}
ul {
padding: 0;
}
ul a {
display: inline-block;
text-decoration: none;
color: #ffefc6;
.menu {
max-width: 300px;
margin: 0 auto;
list-style-type: none;
background-color:#333;
font-weight:bold;
The effect
$.drop-down {
position: relative;
}
.submenu {
position: relative;
opacity: 0;
width: 100%;
z-index: 8;
transition: opacity 0.5s ease;
}
.submenu-item {
display: block;
height: 0px;
overflow: hidden;
transition: height 0.5s ease;
}
.drop-down:hover .submenu {
opacity: 1;
}
.drop-down:hover .submenu-item {
overflow: visible;
height: 30px;
}
About the html code
<ul class="menu">
<li class="itembox drop-down">
<a class="item" href="#">Intro</a>
<div class="submenu">
<a class="submenu-item" href="#">Seting </a>
<a class="submenu-item" href="#">Rule </a>
<a class="submenu-item" href="#">Mode </a>
<a class="submenu-item" href="#">Type </a>
</div>
</li>
You have to use JavaScript, css can't listen to click events.
function toggle(id) {
var elt = document.getElementById(id);
elt.style.display = elt.style.display=='block' ? 'none' : 'block';
}
.submenu {
display: none;
}
<ul>
<li onclick="toggle('submenu-1')">
Option 1
<ul id="submenu-1" class="submenu">
<li>Sub-option 1.1</li>
<li>Sub-option 1.2</li>
</ul>
</li>
<li onclick="toggle('submenu-2')">
Option 2
<ul id="submenu-2" class="submenu">
<li>Sub-option 2.1</li>
<li>Sub-option 2.2</li>
</ul>
</li>
</ul>
I have trouble understanding how to properly align social media icons (left) and logo (center) in mobile / table view in bootstrap. I want the logo and some icons beside the burger menu to be visible even when switching to mobile view, but it does not align properly for me and it shows vertically instead of horizontally when going into mobile view.
Desktop View:
Mobile View:
This is my css/html:
/* Style for "Signup Rectangle" */
.sign-up:hover, .log-in:hover {
cursor: pointer;
border: 1px solid #ffffff;
text-align: center;
}
/* Style for "SIGN UP" */
.sign-up {
color: #ffffff;
font-family: Raleway;
font-size: 13px;
font-weight: 500;
text-transform: uppercase;
}
/* Style for "LOG IN" */
.log-in {
color: #ffffff;
font-family: Raleway;
font-size: 13px;
font-weight: 500;
text-transform: uppercase;
}
/* Style for "Linkedin, Twitter, Facebook" */
.instagram-logo, .twitter-logo, .facebook-logo {
width: 20px;
height: 21px;
filter: invert(100%);
}
.logo {
width: 128px;
height: 53px;
}
.navbar-container {
padding-top: 18px !important;
}
.panorama {
padding-top: 140px;
height: 100vh;
min-height: 400px;
}
.affix {
-webkit-transition: padding 0.2s ease-out;
-moz-transition: padding 0.2s ease-out;
-o-transition: padding 0.2s ease-out;
transition: padding 0.2s ease-out;
}
.affix-top {
background: transparent;
border-color: transparent;
padding: 15px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.icon-bar {
background-color:#fff !important;
}
.affix-top .nav > li > a {
color: #000;
filter: invert(100%);
}
.navbar-nav > li > a {
padding-bottom: 35px;
}
.affix-top .navbar-collapse {
border-color: transparent;
box-shadow: initial;
}
/*************MEDIA QUERIES **************/
#media (min-width: 768px) {
.navbar-nav.navbar-center {
position: absolute;
left: 50%;
transform: translatex(-50%);
}
}
<nav>
<div class="container-fluid">
<div class="navbar navbar-default navbar-fixed-top" data-spy="affix" data-offset-top="400">
<div class="container">
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-container">
<li><img class="instagram-logo" src="{{route('cacheImage', ['newDesign', 'instagram.png']) }}"></li>
<li><img class="facebook-logo" src="{{route('cacheImage', ['newDesign', 'facebook.png']) }}"></li>
<li><img class="twitter-logo" src="{{route('cacheImage', ['newDesign', 'twitter.png']) }}"></li>
</ul>
<ul class="nav navbar-nav navbar-header navbar-center">
<li>
<a href="#">
<img class="na-logo" alt="" src="{{route('cacheImage', ['newDesign', 'logo.png']) }}">
</a>
</li>
</ul>
<ul class="nav navbar-right navbar-nav navbar-container">
<li>
<a class="sign-up">SIGN UP</a>
</li>
<li>
<a class="log-in">LOG IN</a>
</li>
</ul>
</div>
<!-- Mobile Burger Menu -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-burger-menu">
<span class="sr-only">Navigation Menu</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<ul id="navbar-burger-menu" class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</div>
<!-- Mobile Burger Menu End -->
<!-- Mobile / Table view End -->
</div>
</div><!-- /.navbar -->
</div><!-- /.container-fluid -->
<section class="panorama" style="background: url({{route('cacheImage', ['newDesign', 'panorama.png']) }}) no-repeat; background-size:cover; background-position:center;">
<div class="container">
<h1 class="text-center">Hello.</h1>
</div>
</section><!-- panorama navigation section end -->
</nav><!-- .navbar end -->
Anyone can help out with this?
Okay, here ya go. Left menu on left, logo centered, login on right. Hamburger stack below that opens a full width menu.
I floated the left menu to the left and the right one to the right. To get the logo centered in the middle I positioned it absolutely and then set it 50% from the left, minus half the width of the logo. I took off the navbar default to get rid of the gray background that bootstrap automatically puts on it. Also took the collapse off of the navbar-collapse div that the top three ul's were inside of. That way it wouldn't disappear when on mobile. I made the li's inside of the left and right menu be display inline block so they would links would be beside each other. Since the dropdown menu for your hamburger stack is positioned absolutely, I added a right:0 to make it fI'll width. I think that was almost everything.
.navbar-left{
float:left;
}
.navbar-left.nav>li, .navbar-right.nav>li{
display:inline-block;
}
.navbar-right{
float:right;
}
.navbar-center{
position: absolute;
left: calc(50% - 25px);
}
#navbar-burger-menu{
right:0;
}
/* Style for "Signup Rectangle" */
.sign-up:hover, .log-in:hover {
cursor:pointer;
border: 1px solid #ffffff;
text-align:center;
}
/* Style for "SIGN UP" */
.sign-up {
color: #ffffff;
font-family: Raleway;
font-size: 13px;
font-weight: 500;
text-transform: uppercase;
}
/* Style for "LOG IN" */
.log-in {
color: #ffffff;
font-family: Raleway;
font-size: 13px;
font-weight: 500;
text-transform: uppercase;
}
/* Style for "Linkedin, Twitter, Facebook" */
.instagram-logo, .twitter-logo, .facebook-logo{
width: 20px;
height: 21px;
filter: invert(100%);
}
.logo {
width: 128px;
height: 53px;
}
.navbar-container {
padding-top:18px !important;
}
.panorama {
padding-top:140px;
height:100vh;
min-height:400px;
}
.affix {
-webkit-transition:padding 0.2s ease-out;
-moz-transition:padding 0.2s ease-out;
-o-transition:padding 0.2s ease-out;
transition:padding 0.2s ease-out;
}
.affix-top {
background:transparent;
border-color:transparent;
padding: 15px;
-webkit-transition:all 0.5s ease;
-moz-transition:all 0.5s ease;
-o-transition:all 0.5s ease;
transition:all 0.5s ease;
}
.icon-bar {
background-color:#fff !important;
}
.affix-top .nav > li > a {
color: #000;
filter: invert(100%);
}
.navbar-nav > li > a {
padding-bottom:35px;
}
.affix-top .navbar-collapse {
border-color:transparent;
box-shadow:initial;
}
/*************MEDIA QUERIES **************/
#media (min-width: 768px) {
.navbar-nav.navbar-center {
position: absolute;
left: 50%;
transform: translatex(-50%);
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav>
<div class="container-fluid">
<div class="navbar navbar-fixed-top" data-spy="affix" data-offset-top="400">
<div class="container">
<div class="navbar-collapse ">
<ul class="nav navbar-nav navbar-container navbar-left">
<li><img class="instagram-logo" src="http://www.fillmurray.com/100/100"></li>
<li><img class="facebook-logo" src="http://www.fillmurray.com/100/100"></li>
<li><img class="twitter-logo" src="http://www.fillmurray.com/100/100"></li>
</ul>
<ul class="nav navbar-nav navbar-header navbar-center">
<li>
<a href="#">
<img class="na-logo" alt="" src="http://www.fillmurray.com/50/50">
</a>
</li>
</ul>
<ul class="nav navbar-right navbar-nav navbar-container">
<li>
<a class="sign-up">SIGN UP</a>
</li>
<li>
<a class="log-in">LOG IN</a>
</li>
</ul>
</div>
<!-- Mobile Burger Menu -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-burger-menu">
<span class="sr-only">Navigation Menu</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<ul id="navbar-burger-menu" class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</div>
<!-- Mobile Burger Menu End -->
<!-- Mobile / Table view End -->
</div>
</div><!-- /.navbar -->
</div><!-- /.container-fluid -->
<section class="panorama" style="background: url(http://www.fillmurray.com/g/200/300) no-repeat; background-size:cover; background-position:center;">
<div class="container">
<h1 class="text-center">Hello.</h1>
</div>
</section><!-- panorama navigation section end -->
</nav><!-- .navbar end -->
I add an animation when it become "display:block;" :
.button:hover > .list {
display: block;
}
.list {
display: none;
animation: listshow 0.8s ease normal;
}
#keyframes listshow {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="button">
<div>Show</div>
<ul class="list">
<li>1</li>
<li>2</li>
</ul>
</div>
But how can I add an animation when it become "display:none;" ?
Thanks for your time.
Rather than using a keyframe, you can set the element to opacity:0 and then on your :hover set opacity:1 and then add a transition to your your list class (since you are just playing with Opacity):
.button:hover > .list {
display: block;
opacity: 1;
}
.list{
opacity: 0;
transition: 0.8s ease-in-out;
}
<div class="button">
<div>Show</div>
<ul class="list">
<li>1</li>
<li>2</li>
</ul>
</div>