Rounded Corners using jQuery

Posted: April 24th, 2009 | Filed under: jQuery | Tags: | 8 Comments »

jQuery is slowly changing the way web designers and developers create web sites. Here is an extremely easy way to achieve rounded corners using jQuery.

You can view live demos on iSearchNotes.com or at the plug-in webpage.

In order to create our rounded corners you will of course first need jQuery. If you do not already have jQuery hurry up and go download it at jquery.com. I will wait.

Waiting…

Ok so now you will also need to download the rounded corners plug-in. This small jQuery script can be downloaded by saving this file jquery.corner.js

Now we have all that will will need to round those corners. On the page you wish to have the rounded corners on you must add includes to both javascript files.

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.corner.js"></script>

Now we must tell jQuery which areas of the layout to round.

<script type="text/javascript">
$(function(){
$("#content").corner()
});
</script>
<div id="content">Hello this would have rounded corners</div>

This simply uses jQuery’s selectors to select the id content and rounds all 4 of that divs corners by the default amount.

This plug-in can do so much more then this example. You can pick which corners to round, how much to round by, how to round, and much, much, more. Instead of listing them all check out the plug-in page to see more uses of it. (there are some pretty cool ones near the bottom of the page)

There are many different ways to use it but some of the more common uses would be:

	$("#content").corner()
	$("#content").corner("bottom");
	$("#content").corner("top");

You could always avoid javascript altogether and do it the hard way using css.

If you enjoyed this post, make sure you subscribe to my RSS feed!

8 Comments on “Rounded Corners using jQuery”

  1. 1 Graphic Design Links and Tutorials said at 10:32 on April 27th, 2009:

    Rounded Corners using jQuery…

    Rounded Corners using jQuery…

  2. 2 Top tutorials week ending 05/02/09 | FAQPAL Blog said at 17:43 on May 2nd, 2009:

    [...] #2 – Rounded Corners using jQuery [...]

  3. 3 kay said at 00:11 on May 12th, 2009:

    its not working in ie6 :(

  4. 4 CoryMathews said at 21:05 on May 14th, 2009:

    Hum.. I just ran it through browser shots and it seems to be working in ie6. Not sure whats wrong for you.

  5. 5 Tagz | "Rounded Corners using jQuery" | Comments said at 10:01 on May 16th, 2009:

    [...] [upmod] [downmod] Rounded Corners using jQuery (corymathews.com) 1 points posted 2 weeks, 5 days ago by CoryMathews tags jquery saved by 1 [...]

  6. 6 Heri said at 21:18 on May 18th, 2009:

    what made this script not working, at first i installed, it work well on my theme, but then it doesn’t work?
    thanks for the info

  7. 7 amit said at 06:24 on May 25th, 2009:

    this is not working!
    using firefox 3.0.10
    wt can b the reason?

  8. 8 CoryMathews said at 10:50 on May 25th, 2009:

    @heri, gonna need more info then that. Maybe send me a link to the site through the contact form.

    @amit, it normally works in FF3.0.1 send me a link through the contact form and I will help you out.