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);
精彩评论