I've created an animated banner using CSS and it works perfect in Chrome. However, despite using the vedor prefixes (-moz- and -o-), the banner doesn't work in IE nor Firefox.
Here is a jsfiddle of the below:
body {
margin: 50px;
background: #C8C9E0;
}
div#banner_wrapper {
width: 728px;
height: 90px;
margin: 0px auto;
border: #1D1F5E 1px solid;
overflow: hidden;
background-color: #000;
background-image: url(background.jpg);
position: relative;
}
#banner_slide1 {
width: 361px;
height: 55px;
margin-top: 20px;
position: absolute;
left: 160px;
z-index: auto;
}
#banner_slide2 {
width: 355px;
height: 51px;
position: absolute;
margin-top: 22px;
left: 160px;
z-index: 1;
}
#banner_slide3 {
width: 300px;
height: 38px;
position-absolute;
margin-top: 25px;
margin-left: 200px;
z-index: 2;
}
#banner_slide1 {
-webkit-animation-name: banner_slide1;
-webkit-animation-duration: 10s;
-webkit-animation-iteration-count: infinite;
-moz-animation-name: banner_slide1;
-moz-animation-duration: 10s;
-moz-animation-iteration-count: infinite;
-o-animation-name: banner_slide1;
-o-animation-duration: 10s;
-o-animation-iteration-count: infinite;
-animation-name: banner_slide1;
-animation-duration: 10s;
-animation-iteration-count: infinite;
}
#banner_slide2 {
-webkit-animation-name: banner_slide2;
-webkit-animation-duration: 10s;
-webkit-animation-iteration-count: infinite;
-mos-animation-name: banner_slide2;
-moz-animation-duration: 10s;
-moz-animation-iteration-count: infinite;
-o-animation-name: banner_slide2;
-o-animation-duration: 10s;
-o-animation-iteration-count: infinite;
-animation-name: banner_slide2;
-animation-duration: 10s;
-animation-iteration-count: infinite;
}
#banner_slide3 {
-webkit-animation-name: banner_slide3;
-webkit-animation-duration: 10s;
-webkit-animation-iteration-count: infinite;
-mos-animation-name: banner_slide3;
-moz-animation-duration: 10s;
-moz-animation-iteration-count: infinite;
-o-animation-name: banner_slide3;
-o-animation-duration: 10s;
-o-animation-iteration-count: infinite;
-animation-name: banner_slide3;
-animation-duration: 10s;
-animation-iteration-count: infinite;
}
#-webkit-keyframes banner_slide1 {
0% {
opacity: 0;
}
6% {
opacity: 0;
}
8% {
opacity: 1;
}
24% {
opacity: 1;
}
28% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-moz-keyframes banner_slide1 {
0% {
opacity: 0;
}
6% {
opacity: 0;
}
8% {
opacity: 1;
}
24% {
opacity: 1;
}
28% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-o-keyframes banner_slide1 {
0% {
opacity: 0;
}
6% {
opacity: 0;
}
8% {
opacity: 1;
}
24% {
opacity: 1;
}
28% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes banner_slide1 {
0% {
opacity: 0;
}
6% {
opacity: 0;
}
8% {
opacity: 1;
}
24% {
opacity: 1;
}
28% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-webkit-keyframes banner_slide2 {
0% {
opacity: 0;
}
30.5% {
opacity: 0;
}
32.5% {
opacity: 1;
}
52% {
opacity: 1;
}
60% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-moz-keyframes banner_slide2 {
0% {
opacity: 0;
}
30.5% {
opacity: 0;
}
32.5% {
opacity: 1;
}
52% {
opacity: 1;
}
60% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-o-keyframes banner_slide2 {
0% {
opacity: 0;
}
30.5% {
opacity: 0;
}
32.5% {
opacity: 1;
}
52% {
opacity: 1;
}
60% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#keyframes banner_slide2 {
0% {
opacity: 0;
}
30.5% {
opacity: 0;
}
32.5% {
opacity: 1;
}
52% {
opacity: 1;
}
60% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-webkit-keyframes banner_slide3 {
0% {
opacity: 0;
}
60% {
opacity: 0;
}
63% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#-moz-keyframes banner_slide3 {
0% {
opacity: 0;
}
60% {
opacity: 0;
}
63% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#-o-keyframes banner_slide3 {
0% {
opacity: 0;
}
60% {
opacity: 0;
}
63% {
opacity: 1;
}
100% {
opacity: 1;
}
}
#keyframes banner_slide3 {
0% {
opacity: 0;
}
60% {
opacity: 0;
}
63% {
opacity: 1;
}
100% {
opacity: 1;
}
}
<div id="banner_wrapper">
<div id="banner_background">
<a href="#" title="This is title" </a>
</div>
<div id="banner_slide1">
<img src="http://www.placehold.it/50" alt="Alt Text" />
</div>
<div id="banner_slide2">
<img src="http://www.placehold.it/50" alt="Alt Text" />
</div>
<div id="banner_slide3">
<img src="http://www.placehold.it/50" alt="Alt Text" />
</div>
</div>
<a href="# title=" This is title " id="banner_wrapper " </a>
I've already tried every solution I could find both here as well as everywhere else and it still does not work.
Related
How can I make this animated word cycle (made up of absolute positioned spans) to wrap correctly as if it were a regular word inside .sentence? Maybe it's possible to add a ghost inline element with a fixed width (the width of the larger word in the cycle)?
/*Body*/
body {
background-color: #00abe9;
font-family: 'Raleway', sans-serif;
}
/*Heading1*/
h1 {
color: #fff;
font-size: 44px;
margin-top: 40px;
text-align: center;
}
/*Sentence*/
.sentence {
color: #222;
font-size: 30px;
text-align: left;
}
/*Wrapper*/
.wrapper {
background-color: #f5f5f5;
font-family: 'Raleway', sans-serif;
margin: 100px auto;
padding: 40px 40px;
position: relative;
width: 70%;
}
/*Vertical Sliding*/
.slidingVertical {
display: inline;
text-indent: 8px;
}
.slidingVertical span {
animation: topToBottom 12.5s linear infinite 0s;
-ms-animation: topToBottom 12.5s linear infinite 0s;
-webkit-animation: topToBottom 12.5s linear infinite 0s;
color: #00abe9;
opacity: 0;
overflow: hidden;
position: absolute;
}
.slidingVertical span:nth-child(2) {
animation-delay: 2.5s;
-ms-animation-delay: 2.5s;
-webkit-animation-delay: 2.5s;
}
.slidingVertical span:nth-child(3) {
animation-delay: 5s;
-ms-animation-delay: 5s;
-webkit-animation-delay: 5s;
}
.slidingVertical span:nth-child(4) {
animation-delay: 7.5s;
-ms-animation-delay: 7.5s;
-webkit-animation-delay: 7.5s;
}
.slidingVertical span:nth-child(5) {
animation-delay: 10s;
-ms-animation-delay: 10s;
-webkit-animation-delay: 10s;
}
/*topToBottom Animation*/
#-moz-keyframes topToBottom {
0% {
opacity: 0;
}
5% {
opacity: 0;
-moz-transform: translateY(-50px);
}
10% {
opacity: 1;
-moz-transform: translateY(0px);
}
25% {
opacity: 1;
-moz-transform: translateY(0px);
}
30% {
opacity: 0;
-moz-transform: translateY(50px);
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-webkit-keyframes topToBottom {
0% {
opacity: 0;
}
5% {
opacity: 0;
-webkit-transform: translateY(-50px);
}
10% {
opacity: 1;
-webkit-transform: translateY(0px);
}
25% {
opacity: 1;
-webkit-transform: translateY(0px);
}
30% {
opacity: 0;
-webkit-transform: translateY(50px);
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
#-ms-keyframes topToBottom {
0% {
opacity: 0;
}
5% {
opacity: 0;
-ms-transform: translateY(-50px);
}
10% {
opacity: 1;
-ms-transform: translateY(0px);
}
25% {
opacity: 1;
-ms-transform: translateY(0px);
}
30% {
opacity: 0;
-ms-transform: translateY(50px);
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<section class="wrapper">
<h2 class="sentence">Our product is
<div class="slidingVertical">
<span>Amazing.</span>
<span>Beautiful.</span>
<span>Cute.</span>
<span>Delightful.</span>
<span>Emotional.</span>
</div>
</h2>
</section>
View the CodePen.
Don't make all the words position:absolute. Keep one of them position:relative (the longest one) so you can have a correct wrapping:
/*Body*/
body {
background-color: #00abe9;
font-family: 'Raleway', sans-serif;
}
/*Heading1*/
h1 {
color: #fff;
font-size: 44px;
margin-top: 40px;
text-align: center;
}
/*Sentence*/
.sentence {
color: #222;
font-size: 30px;
text-align: left;
}
/*Wrapper*/
.wrapper {
background-color: #f5f5f5;
font-family: 'Raleway', sans-serif;
margin: 100px auto;
padding: 40px 40px;
position: relative;
width: 70%;
}
/*Vertical Sliding*/
.slidingVertical {
display: inline-block;
position:relative; /* added */
vertical-align: text-top; /* added */
}
.slidingVertical span {
animation: topToBottom 12.5s linear infinite 0s;
color: #00abe9;
opacity: 0;
overflow: hidden;
position: absolute;
left:0; /* added */
}
/* added */
.slidingVertical span:nth-child(4) {
position:relative;
display:inline-block;
}
/**/
.slidingVertical span:nth-child(2) {
animation-delay: 2.5s;
}
.slidingVertical span:nth-child(3) {
animation-delay: 5s;
}
.slidingVertical span:nth-child(4) {
animation-delay: 7.5s;
}
.slidingVertical span:nth-child(5) {
animation-delay: 10s;
}
/*topToBottom Animation*/
#keyframes topToBottom {
0% {
opacity: 0;
}
5% {
opacity: 0;
transform: translateY(-50px);
}
10% {
opacity: 1;
transform: translateY(0px);
}
25% {
opacity: 1;
transform: translateY(0px);
}
30% {
opacity: 0;
transform: translateY(50px);
}
80% {
opacity: 0;
}
100% {
opacity: 0;
}
}
<section class="wrapper">
<h2 class="sentence">Our product is
<div class="slidingVertical">
<span>Amazing.</span>
<span>Beautiful.</span>
<span>Cute.</span>
<span>Delightful.</span>
<span>Emotional.</span>
</div>
</h2>
</section>
I copied this code from codepen and there is only 5 text looping I want to add the 6th to show but when i copy the same style with new class name i.e "w6" and the new animation with "w6anim" it doesn't load the 6th waqas. Kindly help!
I tried to change #keyframe values but still, it doesn't work.
#font-face {
font-family: system;
font-style: normal;
font-weight: 600;
src: local(".SFNSText-Light"), local(".HelveticaNeueDeskInterface-Light"), local(".LucidaGrandeUI"), local("Ubuntu Light"), local("Segoe UI Light"), local("Roboto-Light"), local("DroidSans"), local("Tahoma");
}
* {
margin: 0;
padding: 0;
background: transparent;
font-family: "system";
}
.container {
width: 200px;
}
.word {
font-size: 3em;
font-weight: bold;
float: left;
opacity: 0;
position: absolute;
top: 40%;
left: 40%;
}
.w1 {
animation: w1anim 20s infinite;
}
.w2 {
animation: w2anim 20s infinite;
}
.w3 {
animation: w3anim 20s infinite;
}
.w4 {
animation: w4anim 20s infinite;
}
.w5 {
animation: w5anim 20s infinite;
}
.w6 {
animation: w6anim 20s infinite;
color: red;
}
#keyframes w1anim {
0% {
opacity: 0;
}
5% {
opacity: 1;
}
10% {
opacity: 0;
}
}
#keyframes w2anim {
10% {
opacity: 0;
}
15% {
opacity: 1;
}
20% {
opacity: 0;
}
}
#keyframes w3anim {
20% {
opacity: 0;
}
25% {
opacity: 1;
}
30% {
opacity: 0;
}
}
#keyframes w4anim {
30% {
opacity: 0;
}
35% {
opacity: 1;
}
40% {
opacity: 0;
}
}
#keyframes w5anim {
40% {
opacity: 0;
}
45% {
opacity: 1;
}
50% {
opacity: 0;
}
}
#keyframes w6anim {
50% {
opacity: 0 !important;
}
55% {
opacity: 1 !important;
}
60% {
opacity: 0 !important;
}
}
<div class="container">
<div class="word w1">LOREM</div>
<div class="word w2">IPSUM</div>
<div class="word w3">CARPE</div>
<div class="word w4">DIEM</div>
<div class="word w5">AVENO</div>
<div class="word w6">waqas</div>
</div>
link to the codepen https://codepen.io/waqasahmad9961/pen/bGbxpNr
Remote !important and simply copy 1:1 in future cases.. never change a running system
#keyframes w6anim {
50% {
opacity: 0 !important;
}
55% {
opacity: 1 !important;
}
60% {
opacity: 0 !important;
}
}
Remove -> !important
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>
I'm trying to make an automatic DIV slideshow with CSS but I have a problem. I have this code but the animation delay seems like it isn't working or they fade at the same time.
Here is the HTML
<div class="cosafancya">
<div>
<div class="espacioimagen">
<div class="fancyosoleche">
<p class="fancytext"> About us</p>
</div>
<img src="../uploads/agbar.png" class="fotodeslizante" />
</div>
</div>
<div>
<div class="espacioimagen">
<div class="fancyspace">
<p class="fancytext"> About us</p>
</div>
<img src="../uploads/logo.png" class="fotodeslizante" />
</div>
</div>
</div>
Here is the CSS:
.cosafancya {
top: 0; bottom: 0; left: 0; right: 0;
position: absolute;
z-index: 0;
overflow: hidden;
}
.cosafancya div {
animation: Animacionchunga 20s linear infinite ;
-moz-animation: Animacionchunga 20s linear infinite;
-o-animation: Animacionchunga 20s linear infinite;
-webkit-animation: Animacionchunga 20s linear infinite;
}
.cosafancya div:nth-child(2) {
opacity: 0;
animation-delay: 10s;
-webkit-animation-delay: 10s; }
#-webkit-keyframes Animacionchunga {
0% { opacity: 0 }
5% { opacity: 1 }
50% { opacity: 1 }
55% { opacity: 0 }
100% { opacity: 0 }
}
#-moz-keyframes Animacionchunga {
0% { opacity: 0 }
5% { opacity: 1 }
50% { opacity: 1 }
55% { opacity: 0 }
100% { opacity: 0 }
}
#-o-keyframes Animacionchunga {
0% { opacity: 0 }
5% { opacity: 1 }
50% { opacity: 1 }
55% { opacity: 0 }
100% { opacity: 0 }
}
#keyframes Animacionchunga {
0% { opacity: 0 }
5% { opacity: 1 }
50% { opacity: 1 }
55% { opacity: 0 }
100% { opacity: 0 }
}
I'm a beginner programmer so I will thanks all the tips you can give me.
.cosafancya {
top: 0; bottom: 0; left: 0; right: 0;
position: absolute;
z-index: 0;
overflow: hidden;
}
.cosafancya div {
animation: Animacionchunga 20s linear infinite ;
-moz-animation: Animacionchunga 20s linear infinite;
-o-animation: Animacionchunga 20s linear infinite;
-webkit-animation: Animacionchunga 20s linear infinite;
}
.cosafancya div:nth-child(2) {
opacity: 0;
animation-delay: 10s;
-webkit-animation-delay: 10s; }
#-webkit-keyframes Animacionchunga {
0% { opacity: 0 }
5% { opacity: 1 }
50% { opacity: 1 }
55% { opacity: 0 }
100% { opacity: 0 }
}
#-moz-keyframes Animacionchunga {
0% { opacity: 0 }
5% { opacity: 1 }
50% { opacity: 1 }
55% { opacity: 0 }
100% { opacity: 0 }
}
#-o-keyframes Animacionchunga {
0% { opacity: 0 }
5% { opacity: 1 }
50% { opacity: 1 }
55% { opacity: 0 }
100% { opacity: 0 }
}
#keyframes Animacionchunga {
0% { opacity: 0 }
5% { opacity: 1 }
50% { opacity: 1 }
55% { opacity: 0 }
100% { opacity: 0 }
}
<div class="cosafancya">
<div>
<div class="espacioimagen">
<div class="fancyosoleche">
<p class="fancytext"> About us</p>
</div>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRyB3aHHDHNj_pdItM9yc-_MVn9Lrl8k9cWApT2UE8cLrLjHrCo" class="fotodeslizante" />
</div>
</div>
<div>
<div class="espacioimagen">
<div class="fancyspace">
<p class="fancytext"> About us</p>
</div>
<img src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRFzcSMCNl_Mz_6AMknWeYg4RQPrFjc3-X2AWiaUy63yUgXozO9" class="fotodeslizante" />
</div>
</div>
Here is a working example that I used before:
HTML:
<div id="slideshow">
<div>
<img src="//farm6.static.flickr.com/5224/5658667829_2bb7d42a9c_m.jpg">
</div>
<div>
<img src="//farm6.static.flickr.com/5230/5638093881_a791e4f819_m.jpg">
</div>
<div>
Pretty cool eh? This slide is proof the content can be anything.
</div>
CSS:
#slideshow {
margin: 50px auto;
position: relative;
width: 240px;
height: 240px;
padding: 10px;
box-shadow: 0 0 20px rgba(0,0,0,0.4);
}
#slideshow > div {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
}
jQuery JavaScript:
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 3000);
Here is the demo
I'm trying to create a slideshow effect with css3 I have three images which I need to fade into each one another. - each transition needs to last for 3 seconds.
1st image shows for 3seconds then fades to 2nd and same to third
I'm unsure how to work out the percentage for the keyframes.
Codepen http://codepen.io/anon/pen/MYmPYp
#-webkit-keyframes cf4FadeInOut {
0% {
opacity: 1;
}
17% {
opacity: 1;
}
25% {
opacity: 1;
}
92% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-moz-keyframes cf4FadeInOut {
0% {
opacity: 1;
}
17% {
opacity: 1;
}
25% {
opacity: 1;
}
92% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-ms-keyframes cf4FadeInOut {
0% {
opacity: 1;
}
17% {
opacity: 1;
}
25% {
opacity: 1;
}
92% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes cf4FadeInOut {
0% {
opacity: 1;
}
17% {
opacity: 1;
}
25% {
opacity: 1;
}
92% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.team-img {
position: relative;
height: 329px;
width: 450px;
}
.team-img img {
position: absolute;
left: 0;
z-index: 0;
-webkit-animation-name: cf4FadeInOut;
-moz-animation-name: cf4FadeInOut;
-ms-animation-name: cf4FadeInOut;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-duration: 9s;
-moz-animation-duration: 9s;
-ms-animation-duration: 9s;
}
.team-img img:nth-of-type(1) {
-webkit-animation-name: cf4FadeInOut;
-moz-animation-name: cf4FadeInOut;
-ms-animation-name: cf4FadeInOut;
-webkit-animation-delay: 3s;
-moz-animation-delay: 3s;
-ms-animation-delay: 3s;
}
.team-img img:nth-of-type(2) {
-webkit-animation-name: cf4FadeInOut;
-moz-animation-name: cf4FadeInOut;
-ms-animation-name: cf4FadeInOut;
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-ms-animation-delay: 6s;
}
.team-img img:nth-of-type(3) {
-webkit-animation-name: cf4FadeInOut;
-moz-animation-name: cf4FadeInOut;
-ms-animation-name: cf4FadeInOut;
-webkit-animation-delay: 9s;
-moz-animation-delay: 9s;
-ms-animation-delay: 9s;
}
<div class="team-img">
<img width="200px" height="200px" src="http://blackdogballroom.co.uk/nws/wp-content/uploads/sites/2/2014/11/BDB-290212-Img-048.jpg">
<img width="200px" height="200px" src="http://3.bp.blogspot.com/-I2TYXJ3lDYw/UFsjvkedaXI/AAAAAAAAE-w/7EYzTeZMpsc/s1600/00Halloween+Spooks.JPG">
<img width="200px" height="200px" src="http://blog.lafraise.com/fr/wp-content/uploads/2013/11/Free-hug-zoneinfinite.jpg">
</div>
I've been racking my brain for a few hours, slowly losing the will. I've googled effortlessly.
Thanks,
Dan
You need to define three different #keyframes to achieve this.
#-webkit-keyframes two {
0% { opacity: 0; }
8.3% { opacity: 0; }
16.6% { opacity: 0; }
24.9% { opacity: 0; }
33.2% { opacity: 1; }
41.5% { opacity: 1; }
49.5% { opacity: 1; }
58.1% { opacity: 1; }
66.4% { opacity: 0; }
74.7% { opacity: 0; }
83% { opacity: 0; }
91.3% { opacity: 0; }
100% { opacity: 0; }
}
#keyframes two {
0% { opacity: 0; }
8.3% { opacity: 0; }
16.6% { opacity: 0; }
24.9% { opacity: 0; }
33.2% { opacity: 1; }
41.5% { opacity: 1; }
49.5% { opacity: 1; }
58.1% { opacity: 1; }
66.4% { opacity: 0; }
74.7% { opacity: 0; }
83% { opacity: 0; }
91.3% { opacity: 0; }
100% { opacity: 0; }
}
#-webkit-keyframes three {
0% { opacity: 0; }
8.3% { opacity: 0; }
16.6% { opacity: 0; }
24.9% { opacity: 0; }
33.2% { opacity: 0; }
41.5% { opacity: 0; }
49.5% { opacity: 0; }
58.1% { opacity: 0; }
66.4% { opacity: 1; }
74.7% { opacity: 1; }
83% { opacity: 1; }
91.3% { opacity: 1; }
100% { opacity: 0; }
}
#keyframes three {
0% { opacity: 0; }
8.3% { opacity: 0; }
16.6% { opacity: 0; }
24.9% { opacity: 0; }
33.2% { opacity: 0; }
41.5% { opacity: 0; }
49.5% { opacity: 0; }
58.1% { opacity: 0; }
66.4% { opacity: 1; }
74.7% { opacity: 1; }
83% { opacity: 1; }
91.3% { opacity: 1; }
100% { opacity: 0; }
}
.team-img {
position: relative;
height: 329px;
width: 450px;
}
.team-img img {
position: absolute;
left: 0;
z-index: 0;
}
.team-img img:nth-of-type(2) {
-webkit-animation: two 11s ease-in-out infinite forwards;
animation: two 11s ease-in-out infinite forwards;
}
.team-img img:nth-of-type(3) {
-webkit-animation: three 11s ease-in-out infinite forwards;
animation: three 11s ease-in-out infinite forwards;
}
<div class="team-img">
<img width="200px" height="200px" src="http://blackdogballroom.co.uk/nws/wp-content/uploads/sites/2/2014/11/BDB-290212-Img-048.jpg">
<img width="200px" height="200px" src="http://3.bp.blogspot.com/-I2TYXJ3lDYw/UFsjvkedaXI/AAAAAAAAE-w/7EYzTeZMpsc/s1600/00Halloween+Spooks.JPG">
<img width="200px" height="200px" src="http://blog.lafraise.com/fr/wp-content/uploads/2013/11/Free-hug-zoneinfinite.jpg">
</div>
You don't need to animate the first image, only the second and third. It makes a code much shorter:
.team-img {
position: relative;
height: 329px;
width: 450px;
}
.team-img img {
position: absolute;
left: 0;
top: 0;
}
.team-img img:nth-of-type(2) {
opacity: 0;
-webkit-animation: fading2 ease 14s infinite;
animation: fading2 ease 14s infinite;
}
.team-img img:nth-of-type(3) {
opacity: 0;
-webkit-animation: fading3 ease 14s infinite;
animation: fading3 ease 14s infinite;
}
#-webkit-keyframes fading2 {
0%: { opacity: 0;}
21% { opacity: 0;}
35% { opacity: 1;}
93% { opacity: 1;}
100% { opacity: 0;}
}
#keyframes fading2 {
0%: { opacity: 0;}
21% { opacity: 0;}
35% { opacity: 1;}
93% { opacity: 1;}
100% { opacity: 0;}
}
#-webkit-keyframes fading3 {
0%: { opacity: 0;}
56% { opacity: 0;}
70% { opacity: 1;}
93% { opacity: 1;}
100% { opacity: 0;}
}
#keyframes fading3 {
0%: { opacity: 0;}
56% { opacity: 0;}
70% { opacity: 1;}
93% { opacity: 1;}
100% { opacity: 0;}
}
<div class="team-img">
<img width="200px" height="200px" src="http://blackdogballroom.co.uk/nws/wp-content/uploads/sites/2/2014/11/BDB-290212-Img-048.jpg">
<img width="200px" height="200px" src="http://3.bp.blogspot.com/-I2TYXJ3lDYw/UFsjvkedaXI/AAAAAAAAE-w/7EYzTeZMpsc/s1600/00Halloween+Spooks.JPG">
<img width="200px" height="200px" src="http://blog.lafraise.com/fr/wp-content/uploads/2013/11/Free-hug-zoneinfinite.jpg">
</div>