html - Background size shrinks from 'cover' to 50% when using a keyframe animation on 'transform: scale' in Firefox -
i'm trying animate 'transform: scale' property of ::before pseudo element scale(1) scale(1.1), meant animated background of div covers whole viewport. background-size set 'cover' , displays correctly on page load, when animation kicks in after short delay, background shrinks 50% of viewport. works expected in safari, chrome , opera (on mac), on firefox (mac) behaviour described above. on top of that, when resizing browser window down smaller size, displays fine again, see issue in firefox, browser window needs @ least wider 1000px.
example below (jsfiddle: http://jsfiddle.net/yuy4u/embedded/result/).
html:
<!doctype html> <html> <head> <title>animation test case</title> <link href="style.css" rel="stylesheet"> </head> <body> <div>this div</div> </body> </html>
css:
html { height: 100%; width: 100%; } body { height: 100%; margin: 0; padding: 0; width: 100%; overflow: hidden; } div { width: 100%; height: 100%; } div::after { background: url("http://fineartamerica.com/images-simple-print/images-medium/33-landscape-odon-czintos.jpg") top center no-repeat; background-size: cover; content: ""; display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; -moz-animation: bg-anim 10s linear 2s infinite; -webkit-animation: bg-anim 10s linear 2s infinite; -moz-transform: scale(1); -webkit-transform: scale(1); transform: scale(1); } @-moz-keyframes bg-anim { 0% { -moz-transform: scale(1); transform: scale(1); } 50% { -moz-transform: scale(1.1); transform: scale(1.1); } } @-webkit-keyframes bg-anim { 0% { -webkit-transform: scale(1); transform: scale(1); } 50% { -webkit-transform: scale(1.1); transform: scale(1.1); } } @keyframes bg-anim { 0% { -moz-transform: scale(1); -webkit-transform: scale(1); transform: scale(1); } 50% { -moz-transform: scale(1.1); -webkit-transform: scale(1.1); transform: scale(1.1); } }
i've tried changing background-size property percentage value, didn't fix problem , not solution project. i've tried changing scale values 1 , 0.9, works fine, background doesn't cover whole viewport not acceptable situation either.
any ideas on how work around issue? have missed obvious or browser bug or browser-specific implementation discrepancy even?
Comments
Post a Comment