사이트에서 마우스 오버시 애니메이션으로 적용하려는 5 개의 png 이미지 (뚱뚱한 장면을하는 뚱땡이!)가 있습니다. 나는 스프라이트와 CSS 포지셔닝을 사용하여 애니메이션을 만들었지 만, a) mouseover/mouseoff에서 애니메이션을 멈추고 시작하는 방법을 모르거나 ... b) IE에서 작동하지 않습니다. 도움말 http://www.arc-bpictures.com/anim.html 감사합니다.CSS, 스프라이트 애니메이션
0
A
답변
0
#sprite 애니메이션 규칙을 #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-
가 IE에서 작동하는 것입니다로 시작하는 CSS 없음. 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 스프라이트 애니메이션
- 2. 스프라이트 애니메이션
- 3. 복수의 스프라이트 시트에서 애니메이션 스프라이트
- 4. 크롬에서의 JS 스프라이트 애니메이션
- 5. iOS의 애니메이션, 스프라이트
- 6. mouseout에서 리버스 스프라이트 애니메이션
- 7. cocos2d 스프라이트 애니메이션
- 8. 키 누르기의 스프라이트 애니메이션
- 9. 안드로이드, 스프라이트 애니메이션
- 10. 스프라이트 애니메이션 시트
- 11. 애니메이션 스프라이트 및 엔진에 하위 스프라이트 첨부하기
- 12. 스프라이트 시트와 OpenGL을 사용하는 2D 스프라이트 애니메이션
- 13. SVG 이미지의 CSS 스프라이트
- 14. CSS 이미지 스프라이트
- 15. CSS 스프라이트 탐색
- 16. CSS 롤오버 스프라이트
- 17. CSS 목록 스프라이트 정렬
- 18. CSS 스프라이트 위치
- 19. CSS 스프라이트 버튼
- 20. 매개 변수가있는 CSS 스프라이트?
- 21. CSS 스프라이트 사전로드
- 22. CSS 클립 - 스프라이트 이미지
- 23. CSS 스프라이트 사용 하시겠습니까?
- 24. CSS 스프라이트 도움말
- 25. CSS 스프라이트 탐색 문제
- 26. 스프라이트 애니메이션 관리 스레드를 사용하여
- 27. 투명도에서 불투명도의 XNA 애니메이션 스프라이트
- 28. 자바 스크립트 애니메이션 스케일 스프라이트
- 29. 회전 애니메이션 스프라이트 GLES 1
- 30. Cocos2d - 애니메이션 + 스프라이트 중심 카메라?
그 덕분에 아주 많이. IE에서 작동하도록 할 수있는 방법을 제안 할 수 있습니까? 어쨌든 고마워요 –
전 두렵습니다. 내 자바 스크립트 기술은 괜찮지 만 어디서부터 시작해야할지 모르겠다. – MrMisterMan
좋아, 문제 없어요. 제발 좀 도와주세요. 마우스 오버시 애니메이션을 한 번만 실행하고 싶습니다. 어떻게 코드를 변경합니까 : -webkit-animation-iteration-count : 무한; 무한 대신에 무엇을할까요? 감사합니다 –