是否可以更改css动画宽度javascript?
有没有办法使css函数动态化是否可以更改css动画宽度javascript?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,有没有办法使css函数动态化 .test2 { width:200px; height: 90%; -webkit-animation:myfirst2 linear; /* Safari and Chrome */ -webkit-animation-duration: 10s; } @-webkit-keyframes myfirst2 /* Safari and Chrome */ { from { height: 0%; } <--this
.test2
{
width:200px;
height: 90%;
-webkit-animation:myfirst2 linear; /* Safari and Chrome */
-webkit-animation-duration: 10s;
}
@-webkit-keyframes myfirst2 /* Safari and Chrome */
{
from { height: 0%; } <--this must be dynamic
to { height: 90%; } <--this must be dynamic
}
.test2
{
宽度:200px;
身高:90%;
-webkit动画:myfirst2线性;/*Safari和Chrome*/
-webkit动画持续时间:10秒;
}
@-webkit关键帧myfirst2/*Safari和Chrome*/
{
从{height:0%;}可以使用jQuery css()函数
您可以使用jQuery css()函数
使用jQuery和jQuery动画功能
这里有一个JSFIDLE示例:
使用jQuery和jQuery动画功能
这里有一个JSFIDLE示例:
你可以很容易地放弃.css
像这样
//Fade in Background
jQuery('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeOut(); //Fade in the fade layer
//Apply Margin to Popup
jQuery('#' + popID).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft,
'display' : 'block'
});
你可以轻易地放弃
像这样
//Fade in Background
jQuery('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeOut(); //Fade in the fade layer
//Apply Margin to Popup
jQuery('#' + popID).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft,
'display' : 'block'
});
这看起来是你想要的:是的,谢谢Callum Macrae。这是我一直在寻找的解决方案。这看起来是你想要的:是的,谢谢Callum Macrae。这是我一直在寻找的解决方案。