2

http://synergine.net/rain.php

你好。我正在尝试清除 .ripple div 中所有元素的样式属性,但未成功:

function contact(level){
focus_ripple = Math.floor(Math.random() * 100) + 1;
$("#"+level+" .ripple"+focus_ripple+" p").css("opacity",1);
$("#"+level+" .ripple"+focus_ripple+" .fourth").animate({
    height: "324px",
    width: "324px",
    top: "-162px",
    left: "-162px",
    "border-radius": "162px"
},{duration: 1000, queue: false});
$("#"+level+" .ripple"+focus_ripple+" .third").animate({
    height: "108px",
    width: "108px",
    top: "-54px",
    left: "-54px",
    "border-radius": "54px"
},{duration: 1000, queue: false});
$("#"+level+" .ripple"+focus_ripple+" .second").animate({
    height: "32px",
    width: "32px",
    top: "-18px",
    left: "-18px",
    "border-radius": "18px"
},{duration: 1000, queue: false});
$("#"+level+" .ripple"+focus_ripple+" .first").animate({
    height: "10px",
    width: "10px",
    top: "-6px",
    left: "-6px",
    "border-radius": "6px"
},{duration: 1000, queue: false});
$("#"+level+" .ripple"+focus_ripple+" p").animate({
    opacity: 0
},{duration: 1550, queue: false});
setTimeout(function() {
    $("#"+level+" .ripple"+focus_ripple+" p").removeAttr("style");
},1575);
counter++;

}

对此的任何帮助将不胜感激。谢谢。

4

1 回答 1

0

removeAttr()在 1.7.2 上为我工作:

$("div").click(function(){
    $(this).removeAttr("style");
})​

见小提琴:http: //jsfiddle.net/adrianonantua/p5Dcs/

你必须确保你的选择器确实带来了结果。

于 2012-11-28T03:54:52.160 回答