Jos*_*son 5 css jquery function
mac firefox 3.6.13 firebug给了我这个错误:"removeAttribute不是一个函数"我在某些地方读过"removeAttribute"在某些浏览器中有问题然而我需要使用它.如果是浏览器问题,任何人都可以提出不同的方法.
function closeThumbView(){
$("#thumbReelBox").fadeOut(1000, function(){
$("#thumbReelList > li > a, #thumbReelList > li, #thumbReelNav, #thumbReelBox").removeAttribute('style');
});
}
Run Code Online (Sandbox Code Playgroud)
Jas*_*run 19
removeAttribute是一个JavaScript DOM函数.由于您使用的是$(),因此在jQuery对象上运行,您需要使用jQuery等价物,removeAttr()
尝试使用DOM元素removeAttribute()方法:
function closeThumbView(){
$("#thumbReelBox").fadeOut(1000, function(){
els = $("#thumbReelList > li > a, #thumbReelList > li, #thumbReelNav, #thumbReelBox");
for(ind=0;ind<els.length;ind++){
els[ind].removeAttribute('style');
}
});
}
Run Code Online (Sandbox Code Playgroud)
或者如果你想使用JQuery方法,请使用removeAttr()作为受访者之一说:
function closeThumbView(){
$("#thumbReelBox").fadeOut(1000, function(){
els = $("#thumbReelList > li > a, #thumbReelList > li, #thumbReelNav, #thumbReelBox");
els.removeAttr('style');
});
}
Run Code Online (Sandbox Code Playgroud)