可以将.cl​​assA样式的.classB样式动画化吗? [英] can a .classA styles to .classB styles be animated easly?

查看:72
本文介绍了可以将.cl​​assA样式的.classB样式动画化吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



让我们来说说:

  .classA {
color:red;
}
.classB {
color:blue;
}

函数animate(selector,classA,classB,time){
styles1 = $(classA).invented_get_styles();
styles2 = $(classB).invented_get_styles();
$(selector).animate(styles1,styles2,time);
}

几乎这个语法是发明的,但我认为我要问的是了解,



可以从检索样式(自动化)的类中进行动画处理,并应用它们,而不是知道(手动)值?或者如果没有,最好的方法是什么..

解决方案

你可以用 jQueryUI / switchClass ,您只需要自定义构建 jQueryUI启用了效果核心 - 没有别的,大约是11k最小化



示例

  $(.element_to_be_animated).switchClass(oldClass,newClass,1000); 


Is there a way to animate in Jquery without specifying every property?

Lets, say:

.classA{
   color:red;
}
.classB{
   color:blue;
}

function animate(selector,classA,classB,time){
    styles1 = $(classA).invented_get_styles();
    styles2 = $(classB).invented_get_styles();
    $(selector).animate(styles1,styles2,time);
}

Almost alll this syntax is invented but i think that what i am asking can be understood,

Is posible to animate from classes retrieving the styles (automated) and apply them instead of knowing (manual) the values? or if not, what's the best way..

解决方案

You can do it with jQueryUI/switchClass, you only need a custom build of jQueryUI with Effects Core enabled - nothing else, which is about 11k minified

Example

$( ".element_to_be_animated" ).switchClass( "oldClass", "newClass", 1000 );

这篇关于可以将.cl​​assA样式的.classB样式动画化吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆