Skip to content Skip to sidebar Skip to footer

Jquery Rounded Corners Implementation

I have a rather crude implementation of corners for (main_bg.gif) within the wrapping global-inner div. Although now this functions with inner divs to represent each corner, I was

Solution 1:

Use jQuery round corner plugin.

http://jquery.malsup.com/corner/

It's supported in all browsers including IE. It draws corners in IE using nested divs (no images). It also has native border-radius rounding in browsers that support it (Opera 10.5+, Firefox, Safari, and Chrome). So in those browsers the plugin simply sets a css property instead.

Here's How to use it

You need to include the jQuery and the Corner js script before </body>. Then write your jQuery like $('div, p').corner('10px'); and place before ''. So your html will look like the below code. Here i'm making round corners for all div and p tags. If you want to do it for specific id or class then you can do something like $('#myid').corner();

<body><divclass="x"></div><pclass="y"></p><scripttype="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><scripttype="text/javascript"src="http://github.com/malsup/corner/raw/master/jquery.corner.js?v2.11"></script><script>$('div, p').corner();</script></body>

Check working example at http://jsfiddle.net/VLPpk/1

Solution 2:

.rounded {
    -moz-border-radius: 10px; /* Firefox */
    -webkit-border-radius: 10px; /* Safari, Chrome */border-radius: 10px; /* CSS3 */
}

Hope that helps :)

Solution 3:

You can use the the jQuery Curvy Corners Plugin. It will use in modern Browsers the CSS3 Version, but with browsers without the css3 border-radius (IE aso) the plugin create the border radius with javascript.

Post a Comment for "Jquery Rounded Corners Implementation"