jQuery를 사용하여 IE8에서이 작업을 수행하지 못했습니다. IE에 jQuery 배경 위치 애니메이션이있는 버그가있는 것 같습니다. 놀람, 놀람 IE에는 모든 다른 현대 브라우저에 작동하는 무언가에 대한 문제점이있다.
걱정할 필요없이 수정본을 발견했습니다. jQuery를 포함시킨 후이 스크립트를 포함하면 문제가 해결됩니다. 나는 플러그인을 공식 링크를 찾을려고했는데, 그래서 난 그냥 파일을 게시합니다 날짜 일까지을 찾는 포기 :
이
/**
* @author Alexander Farkas
* v. 1.21
*/
(function($) {
if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8
var oldCurCSS = jQuery.curCSS;
jQuery.curCSS = function(elem, name, force){
if(name === 'background-position'){
name = 'backgroundPosition';
}
if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
return oldCurCSS.apply(this, arguments);
}
var style = elem.style;
if (!force && style && style[ name ]){
return style[ name ];
}
return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
};
}
var oldAnim = $.fn.animate;
$.fn.animate = function(prop){
if('background-position' in prop){
prop.backgroundPosition = prop['background-position'];
delete prop['background-position'];
}
if('backgroundPosition' in prop){
prop.backgroundPosition = '('+ prop.backgroundPosition;
}
return oldAnim.apply(this, arguments);
};
function toArray(strg){
strg = strg.replace(/left|top/g,'0px');
strg = strg.replace(/right|bottom/g,'100%');
strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
}
$.fx.step. backgroundPosition = function(fx) {
if (!fx.bgPosReady) {
var start = $.curCSS(fx.elem,'backgroundPosition');
if(!start){//FF2 no inline-style fallback
start = '0px 0px';
}
start = toArray(start);
fx.start = [start[0],start[2]];
var end = toArray(fx.options.curAnim.backgroundPosition);
fx.end = [end[0],end[2]];
fx.unit = [end[1],end[3]];
fx.bgPosReady = true;
}
//return;
var nowPosX = [];
nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
};
})(jQuery);
코드는 이제 IE8에서 완벽하게 작동합니다. 나는 트래픽에서 13 % 만 IE에서 나왔기 때문에 IE7에서 테스트하는 데 신경 쓰지 않았으므로 이전 버전을 지원하지 않아도됩니다 .... 너무 많은 두통.
변경되어야하며 그 결과는 내가 나서서 대신 바닥을 사용하여 시도 이런 경우에 동일 –
입니다. 여전히 같은 오류가 발생합니다. –