开发者

Convert CSS border-radius % values to px dynamically

My CSS has a class circle that contains border-radius: 50%. Unfortunately, some browsers don't support开发者_StackOverflow中文版 the %, and render the circle as a square. I want to dynamically convert the percentages to pixel values for browsers that don't support the percentages.

How can I accomplish this with JavaScript / jQuery?


$('#circle').css("border-radius",$('#circle').width()/2);

See the example http://jsfiddle.net/cZqQ8/

Apparently you should use -moz-border-radius to work with mozilla


Try this dude :

$('.circle').css("border-radius",$('.circle').width()/2);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜