简体   繁体   中英

CSS3 animation behaves different in Firefox

This is the fiddle .

I have searched a solution for this but didn't find one.

The correct one should be the one in Chrome/Opera/Safari.

I want to show only the image from top to bottom.

The HTML:

<div class="container">
   <img class="image" src="http://www.hotel-aramis.com/slider/home/notre-dame-de-paris.jpg" />
</div>

The CSS:

@-webkit-keyframes pan {
0% {
    -webkit-transform: translate(0%, 0%);
}
100% {
    top: 100%;
    -webkit-transform: translate(0%, -100%);
}
}
@keyframes pan {
0% {
    -webkit-transform: translate(0%, 0%);
}
100% {
    top: 100%;
    -webkit-transform: translate(0%, -100%);
}
}

.container {
position:relative;
width:1100px;
height:480px;
overflow:hidden;
background-color:#000;
}
.image {
position:absolute;
top: 0;
max-width:100%;
min-width:100%;
-webkit-animation: pan 5s alternate infinite linear;
animation: pan 5s alternate infinite linear;
}

Firefox doesn't use webkit why your -webkit-transform will do nothing. Change it to transform and it should most likely work.

I made a JSFiddle for you

@-webkit-keyframes pan {
    0% {
        -webkit-transform: translate(0%, 0%);
    }
    100% {
        top: 100%;
        -webkit-transform: translate(0%, -100%);
    }
}
@keyframes pan {
    0% {
        transform: translate(0%, 0%);
    }
    100% {
        top: 100%;
        transform: translate(0%, -100%);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM