0

在我的动画之后,我失去了这些 CSS 样式。有没有办法可以使用 .()append 之类的东西将它们添加回来?并不是$(this).removeAttr('style');

.grid li a:hover img {

-webkit-transition: opacity .3s ease-in;
-moz-transition: opactiy .3s ease-in;
-ms-transition: opacity .3s ease-in;
-o-transition: opacity .3s ease-in;
transition: opacity .3s ease-in;
opacity: 1;
}

.grid:hover li {   
 -webkit-transition: opacity .3s ease-in;
 -moz-transition: opactiy .3s ease-in;
 -ms-transition: opacity .3s ease-in;
 -o-transition: opacity .3s ease-in;
 transition: opacity .3s ease-in;   
 zoom: 1;
 filter: alpha(opacity=1);
 opacity: 0.3;
}

这是执行动画的代码

  $('#container img').addClass("img_org");
    $(this).siblings().css("top", "0px");
     $(this).siblings().stop();
    $(this).parent().detach();       
    $('.pop_title').css({ "margin-left": "25%", "margin-right": "25%", top: "100px", left: "0", "font-size": "200%"});      
    $('#container').css({ left: image.left, top: image.top, opacity: 1})
                   .animate({marginLeft: '25%',marginRight: '25%', top: '150', left: '0'},200,'easeInCubic', function(){

       $('.nextButton, .prevButton, .zoom_back, .zoom_big, .info, .box_counter ').animate({opacity: 1},500);            
       $('.pop_title').css("font-size", "200%").text(content.navgrid[2][location].title);
            });           

    $('#container ul, #container').css({height: "422px",width: "679px"});
4

1 回答 1

0

如果您正在谈论删除内联 CSS 的动画方法,您应该选择不同的方法。尝试只添加一个原始类:

.exampleClass
{
    height:50px;
}

创建该类的 div:

<div class="exampleClass"></div>

动画它:

$('.exampleClass').animate({height:'100px'}, 200);

并删除内联样式以恢复为原始 CSS:

$('.exampleClass').removeAttr('style');

而且您将保留原始 CSS,因为它仍然是样式表。

演示

于 2013-08-29T23:39:44.760 回答