私は、サイト上でmouseoverでアニメーション化したい5つのpngイメージ(hippoはプレスアップをしています!)を持っています。私はスプライトとCSSの位置を使用してそれらをアニメーション化することができましたが、 a)mouseover/mouseoffでアニメーションを停止して開始する方法がわかりません。 b)IEでは機能しません http://www.arc-bpictures.com/anim.html ありがとうCss、sprites animation
0
A
答えて
0
#スプライトのアニメーションルールを#sprite:hover
に移動することができます。
#sprite {
width:197px;
height:250px;
background:url(img/anim1.png) 0 0;
}
#sprite:hover {
-webkit-animation-duration:1200ms;
-webkit-animation-iteration-count:infinite;
-webkit-animation-timing-function:step-start;
-webkit-animation-name:animate01;
-moz-animation-duration:1200ms;
-moz-animation-iteration-count:infinite;
-moz-animation-timing-function:step-start;
-moz-animation-name:animate01;
}
ああ、-webkit-
または-moz-
から始まるいかなるCSSはIEで仕事に行くされていません。 IE < 9の場合、これを達成するにはjavascriptを使用する必要があります(IE9のアニメーションCSSサポートについてはわかりません)。
0
私はIEのcssの問題を助けることができないので、軽いjQueryプラグインを一緒に投げてしまったと思います。
(function($)
{
var p = {
imgObj: false,
timeout:1000,
images:[0,0,0,0],
index: -1
}
function next()
{
if(p.index >= p.images.length -2)
p.index = 0;
else
p.index++;
/*Update image source*/
$(p.imgObj).attr("src",p.images[p.index]);
}
/*Sprite
Turn an img element into an animated sprite
- Call on html img object
params:
timeout = duration between changes
images = Array of image sources
index = Starting index for images, returns to zero if greater than image count
*/
$.fn.sprite = function(params)
{
p.imgObj = this;
if(params)
p = $.extend(true,p, params);
/*Initiate image iteration*/
setInterval(next,p.timeout);
}
})(jQuery);
/*Example:*/
var params = {
images:["http://www.english4today.com/i/element_test48.gif",
"http://www.web2access.org.uk/images/oxygen_test.png",
"https://www.uk.etsglobal.org/store/images/cache/11_UK_logo_test_ico_tests2.jpg?1212756259"]};
/*Attach plugin*/
$("#test").sprite(params);
+0
ありがとうございます。私はあなたの助けに感謝しています。 –
関連する問題
- 1. CSS Spritesの性能
- 2. Shaky CSS Animation
- 3. JQuery Slide Animation + CSS
- 4. cicrle animation with css
- 5. W3 CSS Animation
- 6. CSS Animation on Mozilla Firefox
- 7. CSS Sliver on Nav animation
- 8. Pygame Sprites Dissapearing
- 9. Compass Sprites in Rails 3.2
- 10. CSS animation - rotate3dの 'sliding'を防ぐ
- 11. sprites cocos2dに落ちる
- 12. jQuery animation lags
- 13. Jquery Loop Animation fadeIn
- 14. jquery infite animation loop
- 15. Jquery Animation Troubles
- 16. jquery animation
- 17. jQuery animation of maxHeight
- 18. Jquery Animation not working width%
- 19. TypeError:バインドされていないメソッドsprites()
- 20. SVG Sprites with <use>とxlink:href
- 21. PyGame Sprites時折描画しない
- 22. jQuery Isotope Animation Delay
- 23. anime.js running lights animation
- 24. Jquery animation pagePiling
- 25. ReactJS onClick ReactCSSTransitionGroup animation
- 26. jquery animation on scroll
- 27. CSS AnimationはEdgeでのみ動作しています
- 28. ng2 animation:状態間のCSSプロパティを変更する方法
- 29. loop-jQuery-animationのCSS "clip"プロパティをアニメーション化する方法は?
- 30. CSS animation-fill-modeが表示に機能しない:なし
ことに心より感謝申し上げます。私はそれがIEで動作するようにするために何ができるかを提案できますか?とにかくありがとう –
私は恐れていません。私のjavascriptのスキルは大丈夫ですが、どこから始めるべきか分かりません。 – MrMisterMan
いいえ、問題ありません。何か他のもので私を助けてくれますか?アニメーションをマウスオーバーで一度だけ実行します。どのようにすればコードを変更できますか:-webkit-animation-iteration-count:無限;何が無限の代わりに?おかげで –