Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以更改css动画宽度javascript?_Javascript_Jquery_Html_Css - Fatal编程技术网

是否可以更改css动画宽度javascript?

是否可以更改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

有没有办法使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 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。这是我一直在寻找的解决方案。