CSS Text carousel with fixed text - html

I am trying to recreate a effect found on this page
I searched the web and found something and try to adjust it. But i can't figure out how to align that the text to look like in the example.
I am trying to modify the example but if there is a better practice that u can show me that's even better.
Some help to find documentation about it would be apprenticed to.
html,
body {
font-family: 'Droid Serif', serif;
}
.slider {
height: 320px;
width: 680px;
margin-left: 50px;
overflow: visible;
position: 0%;
}
.mask {
overflow: hidden;
height: 320px;
}
.slider ul {
margin: 0;
padding: 0;
position: relative;
}
.slider li {
width: 680px;
height: 320px;
position: absolute;
top: -325px;
list-style: none;
}
.slider .quote {
font-size: 40px;
font-style: italic;
}
.slider li.anim1 {
-moz-animation: cycle 15s linear infinite;
-webkit-animation: cycle 15s linear infinite;
animation: cycle 15s linear infinite;
}
.slider li.anim2 {
-moz-animation: cycle2 15s linear infinite;
-webkit-animation: cycle2 15s linear infinite;
animation: cycle2 15s linear infinite;
}
.slider li.anim3 {
-moz-animation: cycle3 15s linear infinite;
-webkit-animation: cycle3 15s linear infinite;
animation: cycle3 15s linear infinite;
}
.slider li.anim4 {
-moz-animation: cycle4 15s linear infinite;
-webkit-animation: cycle4 15s linear infinite;
animation: cycle4 15s linear infinite;
}
.slider li.anim5 {
-moz-animation: cycle5 15s linear infinite;
-webkit-animation: cycle5 15s linear infinite;
animation: cycle5 15s linear infinite;
}
.slider:hover li {
-moz-animation-play-state: paused;
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
#-moz-keyframes cycle {
0% {
top: 0px;
}
4% {
top: 0px;
}
16% {
top: 0px;
opacity: 1;
z-index: 0;
}
20% {
top: 325px;
opacity: 0;
z-index: 0;
}
21% {
top: -325px;
opacity: 0;
z-index: -1;
}
92% {
top: -325px;
opacity: 0;
z-index: 0;
}
96% {
top: -325px;
opacity: 0;
}
100% {
top: 0px;
opacity: 1;
}
}
#-moz-keyframes cycle2 {
0% {
top: -325px;
opacity: 0;
}
16% {
top: -325px;
opacity: 0;
}
20% {
top: 0px;
opacity: 1;
}
24% {
top: 0px;
opacity: 1;
}
36% {
top: 0px;
opacity: 1;
z-index: 0;
}
40% {
top: 325px;
opacity: 0;
z-index: 0;
}
41% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-moz-keyframes cycle3 {
0% {
top: -325px;
opacity: 0;
}
36% {
top: -325px;
opacity: 0;
}
40% {
top: 0px;
opacity: 1;
}
44% {
top: 0px;
opacity: 1;
}
56% {
top: 0px;
opacity: 1;
}
60% {
top: 325px;
opacity: 0;
z-index: 0;
}
61% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-moz-keyframes cycle4 {
0% {
top: -325px;
opacity: 0;
}
56% {
top: -325px;
opacity: 0;
}
60% {
top: 0px;
opacity: 1;
}
64% {
top: 0px;
opacity: 1;
}
76% {
top: 0px;
opacity: 1;
z-index: 0;
}
80% {
top: 325px;
opacity: 0;
z-index: 0;
}
81% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-moz-keyframes cycle5 {
0% {
top: -325px;
opacity: 0;
}
76% {
top: -325px;
opacity: 0;
}
80% {
top: 0px;
opacity: 1;
}
84% {
top: 0px;
opacity: 1;
}
96% {
top: 0px;
opacity: 1;
z-index: 0;
}
100% {
top: 325px;
opacity: 0;
z-index: 0;
}
}
#-webkit-keyframes cycle {
0% {
top: 0px;
}
4% {
top: 0px;
}
16% {
top: 0px;
opacity: 1;
z-index: 0;
}
20% {
top: 325px;
opacity: 0;
z-index: 0;
}
21% {
top: -325px;
opacity: 0;
z-index: -1;
}
50% {
top: -325px;
opacity: 0;
z-index: -1;
}
92% {
top: -325px;
opacity: 0;
z-index: 0;
}
96% {
top: -325px;
opacity: 0;
}
100% {
top: 0px;
opacity: 1;
}
}
#-webkit-keyframes cycle2 {
0% {
top: -325px;
opacity: 0;
}
16% {
top: -325px;
opacity: 0;
}
20% {
top: 0px;
opacity: 1;
}
24% {
top: 0px;
opacity: 1;
}
36% {
top: 0px;
opacity: 1;
z-index: 0;
}
40% {
top: 325px;
opacity: 0;
z-index: 0;
}
41% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-webkit-keyframes cycle3 {
0% {
top: -325px;
opacity: 0;
}
36% {
top: -325px;
opacity: 0;
}
40% {
top: 0px;
opacity: 1;
}
44% {
top: 0px;
opacity: 1;
}
56% {
top: 0px;
opacity: 1;
z-index: 0;
}
60% {
top: 325px;
opacity: 0;
z-index: 0;
}
61% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-webkit-keyframes cycle4 {
0% {
top: -325px;
opacity: 0;
}
56% {
top: -325px;
opacity: 0;
}
60% {
top: 0px;
opacity: 1;
}
64% {
top: 0px;
opacity: 1;
}
76% {
top: 0px;
opacity: 1;
z-index: 0;
}
80% {
top: 325px;
opacity: 0;
z-index: 0;
}
81% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-webkit-keyframes cycle5 {
0% {
top: -325px;
opacity: 0;
}
76% {
top: -325px;
opacity: 0;
}
80% {
top: 0px;
opacity: 1;
}
84% {
top: 0px;
opacity: 1;
}
96% {
top: 0px;
opacity: 1;
z-index: 0;
}
100% {
top: 325px;
opacity: 0;
z-index: 0;
}
}
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js">
</script>
<meta charset='utf-8' />
<title>
infinite loop carousel(vertical)
</title>
<style>
</style>
</head>
<body>
<p>review
<span>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">PDF's</div>
</li>
<li class="anim2">
<div class="quote">Prints</div>
</li>
<li class="anim3">
<div class="quote">Pictures</div>
</li>
<li class="anim4">
<div class="quote">colors</div>
</li>
<li class="anim5">
<div class="quote">testtest</div>
</li>
</ul>
</div>
</div>
</div>
</span></p>
</body>
</html>

Why don't you just position absolute the review text on the left side of the slider ? ( that would be one option )
Also you had some span tags and unclosed tags in your html. Please verify it it first
html,
body {
font-family: 'Droid Serif', serif;
}
.leftText {
position:absolute;
left:0;
}
.slider {
height: 320px;
width: 680px;
margin-left: 50px;
overflow: visible;
position: 0%;
}
.mask {
overflow: hidden;
height: 320px;
}
.slider ul {
margin: 0;
padding: 0;
position: relative;
}
.slider li {
width: 680px;
height: 320px;
position: absolute;
top: -325px;
list-style: none;
}
.slider .quote {
font-size: 40px;
font-style: italic;
}
.slider li.anim1 {
-moz-animation: cycle 15s linear infinite;
-webkit-animation: cycle 15s linear infinite;
animation: cycle 15s linear infinite;
}
.slider li.anim2 {
-moz-animation: cycle2 15s linear infinite;
-webkit-animation: cycle2 15s linear infinite;
animation: cycle2 15s linear infinite;
}
.slider li.anim3 {
-moz-animation: cycle3 15s linear infinite;
-webkit-animation: cycle3 15s linear infinite;
animation: cycle3 15s linear infinite;
}
.slider li.anim4 {
-moz-animation: cycle4 15s linear infinite;
-webkit-animation: cycle4 15s linear infinite;
animation: cycle4 15s linear infinite;
}
.slider li.anim5 {
-moz-animation: cycle5 15s linear infinite;
-webkit-animation: cycle5 15s linear infinite;
animation: cycle5 15s linear infinite;
}
.slider:hover li {
-moz-animation-play-state: paused;
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
#-moz-keyframes cycle {
0% {
top: 0px;
}
4% {
top: 0px;
}
16% {
top: 0px;
opacity: 1;
z-index: 0;
}
20% {
top: 325px;
opacity: 0;
z-index: 0;
}
21% {
top: -325px;
opacity: 0;
z-index: -1;
}
92% {
top: -325px;
opacity: 0;
z-index: 0;
}
96% {
top: -325px;
opacity: 0;
}
100% {
top: 0px;
opacity: 1;
}
}
#-moz-keyframes cycle2 {
0% {
top: -325px;
opacity: 0;
}
16% {
top: -325px;
opacity: 0;
}
20% {
top: 0px;
opacity: 1;
}
24% {
top: 0px;
opacity: 1;
}
36% {
top: 0px;
opacity: 1;
z-index: 0;
}
40% {
top: 325px;
opacity: 0;
z-index: 0;
}
41% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-moz-keyframes cycle3 {
0% {
top: -325px;
opacity: 0;
}
36% {
top: -325px;
opacity: 0;
}
40% {
top: 0px;
opacity: 1;
}
44% {
top: 0px;
opacity: 1;
}
56% {
top: 0px;
opacity: 1;
}
60% {
top: 325px;
opacity: 0;
z-index: 0;
}
61% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-moz-keyframes cycle4 {
0% {
top: -325px;
opacity: 0;
}
56% {
top: -325px;
opacity: 0;
}
60% {
top: 0px;
opacity: 1;
}
64% {
top: 0px;
opacity: 1;
}
76% {
top: 0px;
opacity: 1;
z-index: 0;
}
80% {
top: 325px;
opacity: 0;
z-index: 0;
}
81% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-moz-keyframes cycle5 {
0% {
top: -325px;
opacity: 0;
}
76% {
top: -325px;
opacity: 0;
}
80% {
top: 0px;
opacity: 1;
}
84% {
top: 0px;
opacity: 1;
}
96% {
top: 0px;
opacity: 1;
z-index: 0;
}
100% {
top: 325px;
opacity: 0;
z-index: 0;
}
}
#-webkit-keyframes cycle {
0% {
top: 0px;
}
4% {
top: 0px;
}
16% {
top: 0px;
opacity: 1;
z-index: 0;
}
20% {
top: 325px;
opacity: 0;
z-index: 0;
}
21% {
top: -325px;
opacity: 0;
z-index: -1;
}
50% {
top: -325px;
opacity: 0;
z-index: -1;
}
92% {
top: -325px;
opacity: 0;
z-index: 0;
}
96% {
top: -325px;
opacity: 0;
}
100% {
top: 0px;
opacity: 1;
}
}
#-webkit-keyframes cycle2 {
0% {
top: -325px;
opacity: 0;
}
16% {
top: -325px;
opacity: 0;
}
20% {
top: 0px;
opacity: 1;
}
24% {
top: 0px;
opacity: 1;
}
36% {
top: 0px;
opacity: 1;
z-index: 0;
}
40% {
top: 325px;
opacity: 0;
z-index: 0;
}
41% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-webkit-keyframes cycle3 {
0% {
top: -325px;
opacity: 0;
}
36% {
top: -325px;
opacity: 0;
}
40% {
top: 0px;
opacity: 1;
}
44% {
top: 0px;
opacity: 1;
}
56% {
top: 0px;
opacity: 1;
z-index: 0;
}
60% {
top: 325px;
opacity: 0;
z-index: 0;
}
61% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-webkit-keyframes cycle4 {
0% {
top: -325px;
opacity: 0;
}
56% {
top: -325px;
opacity: 0;
}
60% {
top: 0px;
opacity: 1;
}
64% {
top: 0px;
opacity: 1;
}
76% {
top: 0px;
opacity: 1;
z-index: 0;
}
80% {
top: 325px;
opacity: 0;
z-index: 0;
}
81% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#-webkit-keyframes cycle5 {
0% {
top: -325px;
opacity: 0;
}
76% {
top: -325px;
opacity: 0;
}
80% {
top: 0px;
opacity: 1;
}
84% {
top: 0px;
opacity: 1;
}
96% {
top: 0px;
opacity: 1;
z-index: 0;
}
100% {
top: 325px;
opacity: 0;
z-index: 0;
}
}
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js">
</script>
<meta charset='utf-8' />
<title>
infinite loop carousel(vertical)
</title>
<style>
</style>
</head>
<body>
<p class="leftText">review</p>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">PDF's</div>
</li>
<li class="anim2">
<div class="quote">Prints</div>
</li>
<li class="anim3">
<div class="quote">Pictures</div>
</li>
<li class="anim4">
<div class="quote">colors</div>
</li>
<li class="anim5">
<div class="quote">testtest</div>
</li>
</ul>
</div>
</div>
</div>
</span></p>
</body>
</html>

Related

How can I pause CSS animation on hover only between cycles?

I'm creating a CSS only slider with text content.
It's based on https://codepen.io/cassidoo/pen/MyaWzp
html,
body {
font-family: 'Droid Serif', serif;
}
h1 {
font-size: 60px;
text-align: center;
}
.content-slider {
width: 100%;
height: 360px;
}
.slider {
height: 320px;
width: 680px;
margin: 40px auto 0;
overflow: visible;
position: relative;
}
.mask {
overflow: hidden;
height: 320px;
}
.slider ul {
margin: 0;
padding: 0;
position: relative;
}
.slider li {
width: 680px;
height: 320px;
position: absolute;
top: -325px;
list-style: none;
}
.slider .quote {
font-size: 40px;
font-style: italic;
}
.slider .source {
font-size: 20px;
text-align: right;
}
.slider li.anim1 {
animation: cycle 15s linear infinite;
}
.slider li.anim2 {
animation: cycle2 15s linear infinite;
}
.slider li.anim3 {
animation: cycle3 15s linear infinite;
}
.slider li.anim4 {
animation: cycle4 15s linear infinite;
}
.slider li.anim5 {
animation: cycle5 15s linear infinite;
}
.slider:hover li {
animation-play-state: paused;
}
#keyframes cycle {
0% {
top: 0px;
}
4% {
top: 0px;
}
16% {
top: 0px;
opacity: 1;
z-index: 0;
}
20% {
top: 325px;
opacity: 0;
z-index: 0;
}
21% {
top: -325px;
opacity: 0;
z-index: -1;
}
50% {
top: -325px;
opacity: 0;
z-index: -1;
}
92% {
top: -325px;
opacity: 0;
z-index: 0;
}
96% {
top: -325px;
opacity: 0;
}
100% {
top: 0px;
opacity: 1;
}
}
#keyframes cycle2 {
0% {
top: -325px;
opacity: 0;
}
16% {
top: -325px;
opacity: 0;
}
20% {
top: 0px;
opacity: 1;
}
24% {
top: 0px;
opacity: 1;
}
36% {
top: 0px;
opacity: 1;
z-index: 0;
}
40% {
top: 325px;
opacity: 0;
z-index: 0;
}
41% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#keyframes cycle3 {
0% {
top: -325px;
opacity: 0;
}
36% {
top: -325px;
opacity: 0;
}
40% {
top: 0px;
opacity: 1;
}
44% {
top: 0px;
opacity: 1;
}
56% {
top: 0px;
opacity: 1;
z-index: 0;
}
60% {
top: 325px;
opacity: 0;
z-index: 0;
}
61% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#keyframes cycle4 {
0% {
top: -325px;
opacity: 0;
}
56% {
top: -325px;
opacity: 0;
}
60% {
top: 0px;
opacity: 1;
}
64% {
top: 0px;
opacity: 1;
}
76% {
top: 0px;
opacity: 1;
z-index: 0;
}
80% {
top: 325px;
opacity: 0;
z-index: 0;
}
81% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#keyframes cycle5 {
0% {
top: -325px;
opacity: 0;
}
76% {
top: -325px;
opacity: 0;
}
80% {
top: 0px;
opacity: 1;
}
84% {
top: 0px;
opacity: 1;
}
96% {
top: 0px;
opacity: 1;
z-index: 0;
}
100% {
top: 325px;
opacity: 0;
z-index: 0;
}
}
<h1>Pure CSS3 Text Carousel</h1>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Hello, this is a quote from a person.</div>
<div class="source">- Person</div>
</li>
<li class="anim2">
<div class="quote">Hello, this is a quote from another person.</div>
<div class="source">- Another person</div>
</li>
<li class="anim3">
<div class="quote">Hello, this is a quote from an animal.</div>
<div class="source">- Animal</div>
</li>
<li class="anim4">
<div class="quote">Hello, this is a quote from a plant.</div>
<div class="source">- Plant</div>
</li>
<li class="anim5">
<div class="quote">How do ya like that.</div>
<div class="source">- Cassidy</div>
</li>
</ul>
</div>
</div>
</div>
Everything works fine, but the pause on hover function pauses the animation in the current position, which can be in the middle of a cycle. This is the correct en obvious behavior, but not ideal for my slider.
The image below shows a cycle paused at about 50%:
Is there some way to get the active cycle to finish before pausing?
If not, would there be some trick to disable pointer-events during cycles?
UPDATE:
I have it working now in Chrome and Firefox, but Safari does not seem to accept pointer-events in keyframes.
I added a background to confirm the timing for the idle instances.
I actually added an extra keyframe for this on the .slider div and added step-start to remove the transition. This animation also pauses on hover, of course, otherwise the animations would run asynchronously after hovering the slider.
https://jsfiddle.net/8f1senmt/
Anyone know why Safari does not play along? Would it just be a restriction or is another setting messing this up?
I played a bit with your code, if you add these lines it will work.
I added pointer-events: none to the slider. Only in specific frames it will be set to auto.
I gave background-color to the slider in the frames where you can hover and only then it will stop. The only problem is :hover will only be recognised, if you move with your mouse. So if the mouse is in the slider, but not moving it won't work.
You will also need to adjust the time-frames, because the background-color is not on the right frame.
.slider {
height: 320px;
width: 680px;
margin: 40px auto 0;
overflow: visible;
position: relative;
pointer-events: none;
animation: slidercycle 15s linear infinite;
}
.slider:hover{
animation-play-state: paused;
}
#keyframes slidercycle {
0% {
pointer-events: none;
}
19% {
pointer-events: auto;
background-color: transparent;
}
20% {
pointer-events: auto;
background-color: red;
}
21% {
pointer-events: none;
background-color: transparent;
}
39%{
pointer-events: none;
background-color: transparent;
}
40% {
pointer-events: auto;
background-color: blue;
}
41% {
pointer-events: none;
background-color: transparent;
}
59%{
pointer-events: none;
background-color: transparent;
}
60% {
pointer-events: auto;
background-color: green;
}
61% {
pointer-events: none;
background-color: transparent;
}
79%{
pointer-events: none;
background-color: transparent;
}
80% {
pointer-events: auto;
background-color: yellow;
}
81% {
pointer-events: none;
background-color: transparent;
}
100%{
pointer-events: none;
background-color: transparent;
}
}
Im not sure about this, but I think you could also use only one cicle for each list element and work with animation-delay.

Text Slider built with CSS animation not showing on mobile

I'm working on my first portfolio website and wanted to add a text slider on the homepage that would cycle through a list.
Published draft is here: https://ryanpearson.website/
On desktop the list cycles through fine. When I use Chrome devtools to inspect and change screen size down to mobile, the list cycles fine. However, when I load the page on an actual cell phone or tablet, instead of using responsive sizing w/ devtools, the slider portion of this text disappears. I cant figure out why.
I thought maybe it was the elements needing a defined height, or that some of my animation isn't supported. . . but the phone i'm using is an iPHone XS, and the newest iPad.
HTML and CSS:
<div class="container-banner-text">
<span class="banner-text">Hi, I'm Ryan and I
<br>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">am a jr web dev.</div>
</li>
<li class="anim2">
<div class="quote">love learning.</div>
</li>
<li class="anim3">
<div class="quote">love organization.</div>
</li>
<li class="anim4">
<div class="quote">love beautiful design.</div>
</li>
<li class="anim5">
<div class="quote">love efficiency.</div>
</li>
</ul>
</div>
</div>
</div>
</span>
</div>
.container-banner-text {
position: absolute;
top:40%;
text-align: center;
width:100%;
}
.banner-text {
color: rgba(var(--white), 1);
font-family: Roboto, sans-serif ;
font-size: 2.5rem;
font-weight: 400;
margin:auto;
}
/* text carousel */
.slider {
text-align: center;
margin: 0 auto;
position: relative;
}
.mask {
overflow: hidden;
height: 45vh;
}
.slider ul {
margin: 0;
padding: 0;
position: relative;
}
.slider li {
position: absolute;
list-style: none;
margin:auto;
text-align:center;
width:100%;
background: rgba(var(--white), 1);
background: -webkit-linear-gradient(right, rgba(var(--red),1), rgba(var(--orange),1),rgba(var(--gold),1));
background-clip: border-box;
background-clip: text ;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.slider li.anim1 {
animation: cycle 15s linear infinite;
}
.slider li.anim2 {
animation: cycle2 15s linear infinite;
}
.slider li.anim3 {
animation: cycle3 15s linear infinite;
}
.slider li.anim4 {
animation: cycle4 15s linear infinite;
}
.slider li.anim5 {
animation: cycle5 15s linear infinite;
}
.slider:hover li {
animation-play-state: paused;
}
#keyframes cycle {
0% {
top: 0px;
}
4% {
top: 0px;
}
16% {
top: 0px;
opacity: 1;
z-index: 0;
}
20% {
top: 325px;
opacity: 0;
z-index: 0;
}
21% {
top: -325px;
opacity: 0;
z-index: -1;
}
50% {
top: -325px;
opacity: 0;
z-index: -1;
}
92% {
top: -325px;
opacity: 0;
z-index: 0;
}
96% {
top: -325px;
opacity: 0;
}
100% {
top: 0px;
opacity: 1;
}
}
#keyframes cycle2 {
0% {
top: -325px;
opacity: 0;
}
16% {
top: -325px;
opacity: 0;
}
20% {
top: 0px;
opacity: 1;
}
24% {
top: 0px;
opacity: 1;
}
36% {
top: 0px;
opacity: 1;
z-index: 0;
}
40% {
top: 325px;
opacity: 0;
z-index: 0;
}
41% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#keyframes cycle3 {
0% {
top: -325px;
opacity: 0;
}
36% {
top: -325px;
opacity: 0;
}
40% {
top: 0px;
opacity: 1;
}
44% {
top: 0px;
opacity: 1;
}
56% {
top: 0px;
opacity: 1;
z-index: 0;
}
60% {
top: 325px;
opacity: 0;
z-index: 0;
}
61% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#keyframes cycle4 {
0% {
top: -325px;
opacity: 0;
}
56% {
top: -325px;
opacity: 0;
}
60% {
top: 0px;
opacity: 1;
}
64% {
top: 0px;
opacity: 1;
}
76% {
top: 0px;
opacity: 1;
z-index: 0;
}
80% {
top: 325px;
opacity: 0;
z-index: 0;
}
81% {
top: -325px;
opacity: 0;
z-index: -1;
}
100% {
top: -325px;
opacity: 0;
z-index: -1;
}
}
#keyframes cycle5 {
0% {
top: -325px;
opacity: 0;
}
76% {
top: -325px;
opacity: 0;
}
80% {
top: 0px;
opacity: 1;
}
84% {
top: 0px;
opacity: 1;
}
96% {
top: 0px;
opacity: 1;
z-index: 0;
}
100% {
top: 325px;
opacity: 0;
z-index: 0;
}
}

How to make transition of Headings in Landing Page

My HomePage has under navigation bar a 1024x500px slideshow going on.
I want headings over that slideshow.
The headings should contain some sentences, for example "Digital art".
I would like to make transitions for those headings and text.
They should change every few seconds, fly in and out, or fade in and out, not sure.
How can I make that?
Thank you all.
Here is a screenshot if the situation. http://pokit.org/get/?9e3304f02be8142576ed1a0fa568efc1.jpg
Slider is not the problem. I want the headings to move over it.
This is the html section, the div that contains the slideshow, and I already put one h1
<div class="heroImg" id="heroImg">
<h1>
Graphic Design and Digital Art
</h1>
<div id=slidercontainer>
<div id=css3slider>
<img src="images/slideshowimg/malay.jpg" alt="White-tailed kite" >
<img src="images/slideshowimg/jkarta.jpg" alt="Hawk title=Hawk" >
<img src="images/slideshowimg/american.jpg" alt="Osprey" >
<img src="images/slideshowimg/aya.jpg" alt="Square-tailed kite" >
<img src="images/slideshowimg/malay.jpg" alt="White-tailed kite" >
</div>
</div>
</div>
This is the css -
#heroImg h1 {
color: rgba(255,102,0,1);
position: absolute;
top: 250px;
z-index: 99;
font-family: "Exo 2", "sans-serif;";
font-size: 2em;
left: 170px;
}
/* Slider CSS */
#-webkit-keyframes slider {
0% { left: 0; opacity: 0; }
2% { opacity: 1; }
20% { left: 0; opacity: 1; }
21% { opacity: 0; }
24% { opacity: 0; }
25% { left: -1024px; opacity: 1; }
45% { left: -1024px; opacity: 1; }
46% { opacity: 0; }
48% { opacity: 0; }
50% { left: -2048px; opacity: 1; } 70% { left: -2048px; opacity: 1; }
72% { opacity: 0; }
74% { opacity: 0; }
75% { left: -3072px; opacity: 1; }
95% { left: -3072px; opacity: 1; }
97% { left: -3072px; opacity: 0; }
100% { left: 0; opacity: 0; }
}
#-moz-keyframes slider {
0% { left: 0; opacity: 0; }
2% { opacity: 1; }
20% { left: 0; opacity: 1; }
21% { opacity: 0; }
24% { opacity: 0; }
25% { left: -1024px; opacity: 1; }
45% { left: -1024px; opacity: 1; }
46% { opacity: 0; }
48% { opacity: 0; }
50% { left: -2048px; opacity: 1; } 70% { left: -2048px; opacity: 1; }
72% { opacity: 0; }
74% { opacity: 0; }
75% { left: -3072px; opacity: 1; }
95% { left: -3072px; opacity: 1; }
97% { left: -3072px; opacity: 0; }
100% { left: 0; opacity: 0; }}
#-o-keyframes slider {
0% { left: 0; opacity: 0; }
2% { opacity: 1; }
20% { left: 0; opacity: 1; }
21% { opacity: 0; }
24% { opacity: 0; }
25% { left: -1024px; opacity: 1; }
45% { left: -1024px; opacity: 1; }
46% { opacity: 0; }
48% { opacity: 0; }
50% { left: -2048px; opacity: 1; }
70% { left: -2048px; opacity: 1; } 72% { opacity: 0; }
74% { opacity: 0; }
75% { left: -3072px; opacity: 1; }
95% { left: -3072px; opacity: 1; }
97% { left: -3072px; opacity: 0; }
100% { left: 0; opacity: 0; }}
#keyframes slider {
0% { left: 0; opacity: 0; }
2% { opacity: 1; }
20% { left: 0; opacity: 1; }
21% { opacity: 0; }
24% { opacity: 0; }
25% { left: -1024px; opacity: 1; }
45% { left: -1024px; opacity: 1; }
46% { opacity: 0; }
48% { opacity: 0; }
50% { left: -2048px; opacity: 1; }
70% { left: -2048px; opacity: 1; } 72% { opacity: 0; }
74% { opacity: 0; }
75% { left: -3072px; opacity: 1; }
95% { left: -3072px; opacity: 1; }
97% { left: -3072px; opacity: 0; }
100% { left: 0; opacity: 0; }}
div#slidercontainer {
position: relative;
overflow: hidden;
background: #000
}
div#slidercontainer {
width: 1024px;
height: 500px;
}
div#sidercontainer img {
width: 1024px;
height: 500px;
float: left;
}
div#css3slider {
position: absolute;
width:5120px;
-webkit-animation-name:slider;
-webkit-animation-duration:20s;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count:infinite;
-moz-animation-name:slider;
-moz-animation-duration:20s;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count:infinite;
-o-animation-name:slider;
-o-animation-duration:20s;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count:infinite;
animation-name:slider;
animation-duration:20s;
animation-timing-function: ease-in-out;
animation-iteration-count:infinite;
}
div#css3slider img {
float: right;
}
div#slidercontainer:after {
font-size: 150px;
position: absolute;
z-index: 12;
color: rgba(255,255,255, 0);
left: 300px; top: 80px;
-webkit-transition: 1s all ease-in-out;
-ms-transition: 1s all ease-in-out;
-moz-transition: 1s all ease-in-out;
-o-transition: 1s all ease-in-out;
transition: 1s all ease-in-out;
}
div#slidercontainer:hover:after {
color: rgba(255,255,255, 0.6);
}
Try this
div#sidercontainer div.slidecontent {
width: 1024px;
height: 500px;
float: left;
}
div#css3slider div.slidecontent {
float: right;
}
Then add slide content div instead of image like
<div id=css3slider>
<div class="slidecontent">
<h1>Text to show</h1>
<img src="images/slideshowimg/image1.jpg" alt="" >
</div>
</div>

CSS3 Slider Animation Issue [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Here is a link to my Portfolio.
In the bottom half, you'll see the portfolio div and short of the fact that it's not centered, I'm trying to do some CSS3 animations on it to mimic a slider. However, I am having a hell of a time trying to get it to work.
Here is a link to the CodePen.
Short of the colors,the footer not working by sitting at the bottom at all times dont' want to set a height, I need help trying to figure out where I'm going wrong with my transitions from left to right in my slider.
I was following two different tutorials, and trying to dissect them to achieve what I have here. The main reason I am going through route as opposed to using JavaScript is that
I haven't learned it yet
I feel that CSS is going to transform into a very, very powerful tool.
My goal is to make my entire portfolio website JavaScript free.
If someone can take a look and offer suggestions, that'd be fantastic!!!
Here is a FIDDLE that is working as a pure CSS slider that I kludged from HERE.
You can just plug the HTML into your middle div, and add the CSS, and make some adjustments.
Can you explain your problem with the footer a bit more?
The HTML is straight-forward, and here is the CSS:
img {
width: 400px;
height: 300px;
}
#slider {
background: #000;
border: 5px solid #eaeaea;
box-shadow: 1px 1px 5px rgba(0,0,0,0.7);
height: 300px;
width: 400px;
margin: 40px auto 0;
overflow: visible;
position: relative;
}
#mask {
overflow: hidden;
height: 320px;
}
#keyframes cycle {
0% { top: 0px; }
4% { top: 0px; }
16% { top: 0px; opacity:1; z-index:0; }
20% { top: 325px; opacity: 0; z-index: 0; }
21% { top: -325px; opacity: 0; z-index: -1; }
92% { top: -325px; opacity: 0; z-index: 0; }
96% { top: -325px; opacity: 0; }
100%{ top: 0px; opacity: 1; }
}
#keyframes cycletwo {
0% { top: -325px; opacity: 0; }
16% { top: -325px; opacity: 0; }
20% { top: 0px; opacity: 1; }
24% { top: 0px; opacity: 1; }
36% { top: 0px; opacity: 1; z-index: 0; }
40% { top: 325px; opacity: 0; z-index: 0; }
41% { top: -325px; opacity: 0; z-index: -1; }
100%{ top: -325px; opacity: 0; z-index: -1; }
}
#keyframes cyclethree {
0% { top: -325px; opacity: 0; }
36% { top: -325px; opacity: 0; }
40% { top: 0px; opacity: 1; }
44% { top: 0px; opacity: 1; }
56% { top: 0px; opacity: 1; }
60% { top: 325px; opacity: 0; z-index: 0; }
61% { top: -325px; opacity: 0; z-index: -1; }
100%{ top: -325px; opacity: 0; z-index: -1; }
}
#keyframes cyclefour {
0% { top: -325px; opacity: 0; }
56% { top: -325px; opacity: 0; }
60% { top: 0px; opacity: 1; }
64% { top: 0px; opacity: 1; }
76% { top: 0px; opacity: 1; z-index: 0; }
80% { top: 325px; opacity: 0; z-index: 0; }
81% { top: -325px; opacity: 0; z-index: -1; }
100%{ top: -325px; opacity: 0; z-index: -1; }
}
#keyframes cyclefive {
0% { top: -325px; opacity: 0; }
76% { top: -325px; opacity: 0; }
80% { top: 0px; opacity: 1; }
84% { top: 0px; opacity: 1; }
96% { top: 0px; opacity: 1; z-index: 0; }
100%{ top: 325px; opacity: 0; z-index: 0; }
}
#keyframes move {
0% { transform: translateX(0); }
100% { transform: translateX(100px); }
}
#keyframes move {
0% { transform: translateX(0); }
50% { transform: translateX(20px); }
100% { transform: translateX(100px); }
}
#slider ul {
margin: 0;
padding: 0;
position: relative;
}
#slider li {
width: 680px;
height: 320px;
position: absolute;
top: -325px;
list-style: none;
}
#slider li.firstanimation {
animation: cycle 25s linear infinite;
}
#slider li.secondanimation {
animation: cycletwo 25s linear infinite;
}
#slider li.thirdanimation {
animation: cyclethree 25s linear infinite;
}
#slider li.fourthanimation {
animation: cyclefour 25s linear infinite;
}
#slider li.fifthanimation {
animation: cyclefive 25s linear infinite;
}

css animations not working in opera

I'm using the following code for generating animations on my webpage. It works fine in safari, firefox and chrome but does not work in opera. One more thing, on the w3c reference for #keyframes rule, the syntax given for opera is "#-o-keyframes" but instead it works on "#keyframes".
The problem that I am facing is that the animation works only once. After that it starts acting weirdly.
Here is the markup.
<div id="content-slider">
<div id="slider"> <!-- Slider container -->
<div id="mask"> <!-- Mask -->
<ul>
<li id="first" class="firstanimation"> <!-- ID for tooltip and class for animation -->
<img src="HP-7.jpeg" alt="Cougar"/>
<div class="tooltip"> <h1>Harry Potter 7</h1> </div>
</li>
<li id="second" class="secondanimation">
<img src="SH-2.jpg" alt="Lions" />
<div class="tooltip"> <h1>Sherlock Holmes 2</h1> </div>
</li>
<li id="third" class="thirdanimation">
<img src="rango.jpg" alt="Snowalker"/>
<div class="tooltip"> <h1>Rango</h1> </div>
</li>
<li id="fourth" class="fourthanimation">
<img src="DM.png" alt="Howling"/>
<div class="tooltip"> <h1>Despicable Me 2</h1> </div>
</li>
<li id="fifth" class="fifthanimation">
<img src="Mad-3.jpeg" alt="Sunbathing"/>
<div class="tooltip"> <h1>Madagascar 3</h1> </div>
</li>
</ul>
</div> <!-- End Mask -->
<div class="progress-bar">
</div> <!-- Progress Bar -->
</div> <!-- End Slider Container -->
</div>
The CSS.
#slider {
float: right;
background: #000000;
border: 3px solid #8B7355;
box-shadow: 1px 1px 5px rgba(0,0,0,0.7);
height: 255px;
margin: 18px 2%;
width: 75%;
overflow: visible;
position: relative;
}
/* HIDE ALL OUTSIDE OF THE SLIDER */
#mask {
overflow: hidden;
height: 255px;
}
/* IMAGE LIST */
#slider ul {
margin: 0;
padding: 0;
position: relative;
}
#slider li {
width: 75%; /* Width Image */
height: 253px; /* Height Image */
position: absolute;
top: -250px; /* Original Position - Inside of the Slider */
list-style: none;
}
#slider img {
width:820px;
height: 255px;
}
#slider li.firstanimation {
animation: cycle 25s linear infinite;
-o-animation: cycle 25s linear infinite;
}
#slider li.secondanimation {
animation: cycletwo 25s linear infinite;
-o-animation: cycletwo 25s linear infinite;
}
#slider li.thirdanimation {
animation: cyclethree 25s linear infinite;
-o-animation: cyclethree 25s linear infinite;
}
#slider li.fourthanimation {
animation: cyclefour 25s linear infinite;
-o-animation: cyclefour 25s linear infinite;
}
#slider li.fifthanimation {
animation: cyclefive 25s linear infinite;
-o-animation: cyclefive 25s linear infinite;
}
#keyframes cycle {
0% { top: 0px; } /* When you start the slide, the first image is already visible */
4% { top: 0px; } /* Original Position */
16% { top: 0px; opacity:1; z-index:0; } /* From 4% to 16 % = for 3 seconds the image is visible */
20% { top: 250px; opacity: 0; z-index: 0; } /* From 16% to 20% = for 1 second exit image */
21% { top: -250px; opacity: 0; z-index: -1; } /* Return to Original Position */
92% { top: -250px; opacity: 0; z-index: 0; }
96% { top: -250px; opacity: 0; } /* From 96% to 100% = for 1 second enter image*/
100%{ top: 0px; opacity: 1; }
}
#keyframes cycletwo {
0% { top: -250px; opacity: 0; } /* Original Position */
16% { top: -250px; opacity: 0; }/* Starts moving after 16% to this position */
20% { top: 0px; opacity: 1; }
24% { top: 0px; opacity: 1; } /* From 20% to 24% = for 1 second enter image*/
36% { top: 0px; opacity: 1; z-index: 0; } /* From 24% to 36 % = for 3 seconds the image is visible */
40% { top: 250px; opacity: 0; z-index: 0; } /* From 36% to 40% = for 1 second exit image */
41% { top: -250px; opacity: 0; z-index: -1; } /* Return to Original Position */
100%{ top: -250px; opacity: 0; z-index: -1; }
}
#keyframes cyclethree {
0% { top: -250px; opacity: 0; }
36% { top: -250px; opacity: 0; }
40% { top: 0px; opacity: 1; }
44% { top: 0px; opacity: 1; }
56% { top: 0px; opacity: 1; }
60% { top: 250px; opacity: 0; z-index: 0; }
61% { top: -250px; opacity: 0; z-index: -1; }
100%{ top: -250px; opacity: 0; z-index: -1; }
}
#keyframes cyclefour {
0% { top: -250px; opacity: 0; }
56% { top: -250px; opacity: 0; }
60% { top: 0px; opacity: 1; }
64% { top: 0px; opacity: 1; }
76% { top: 0px; opacity: 1; z-index: 0; }
80% { top: 250px; opacity: 0; z-index: 0; }
81% { top: -250px; opacity: 0; z-index: -1; }
100%{ top: -250px; opacity: 0; z-index: -1; }
}
#keyframes cyclefive {
0% { top: -250px; opacity: 0; }
76% { top: -250px; opacity: 0; }
80% { top: 0px; opacity: 1; }
84% { top: 0px; opacity: 1; }
96% { top: 0px; opacity: 1; z-index: 0; }
100%{ top: 250px; opacity: 0; z-index: 0; }
}
This may be due to an error, or (most likely) is due to the fact that CSS animations are very new and not exactly reliable. You should always be aware of how your webpage will look without the animations running, because the browser support just isn't there yet, and probably won't be for the next couple of years.
jQuery animations are supported by more browsers (and, IMO, much easier to program). However, even these animations have their setbacks.
Going for the new stuff is cool and all, but make sure you have a solid "base" of the "old stuff" for browsers to fall back on.