Yesterday at 5:15 PM, I was jones-ing for my quick email fix after being away from the computer for almost 48 hours so I fired up Thunderbird and instantly grabbed a few RSS feeds I subscribe to. (On the weekends I’m swamped with home renovation projects and all my free time is spent with friends and family… AWAY from the computer)

My new “buddy” Dustin Diaz (who included a reference to me and this site in his most recent audioblog) posted an edgy “take-it-or-leave-it” kind of post called “Enough With Rounded Corners”.

So I checked out this new resource for rounded corners and saw that the html would be perfect for an impromptu tutorial on jQuery – combining the wrap(), prepend(), and append() functions.

Where Are The Other Divs?

Look closely at the code above and you’ll see that all of the divs fit nicely inside of each other and also wrap nicely around the content that will go inside our rounded box we’ll soon create.

You should also notice that I’ve left out quite a bit of the markup from the original. That’s because the wrap() function in jQuery needs perfectly nested divs in order to work.

Specifically, I’ve left out these two parts:

<div class="hd"><div class="c"></div></div>

<div class="ft"><div class="c"></div></div>

Append and Prepend All At Once

If you notice, the parts that I left out go just inside, but at the beginning and at the end of the class=”dialog” div. This is a perfect opportunity to use append and prepend functions of jQuery and chain them together.

Example And Code

I’ve put a Rounded Corners with jQuery example online for you to see. Be sure to view the source code because I want you to see how clean the html looks when all the javascript and CSS is packaged off into separate files.

Rounded Corners Without Images

There are many other ways to create rounded corners – some involving no images whatsoever.

On the jQuery site there’s a plugin for making rounded corners without images. It’s not for everyone (or every application) but worth checking out. Don’t ask me to break down the code because it’s pretty intense and chok full of trig functions that I am a little rusty on.

Dustin,
Great to see you back! How’s that for a quick turnaround…? I see your post yesterday and in 24 hours I’ve put a jQuery spin on it.

For anyone reading this that hasn’t seen Dustin’s site, I suggest checking it out. Great stuff and very entertaining podcast (think web topics over a beer or two).

As an aside, everyone look at that last bit of code I posted for an alternative to the $(document).ready function. In other words, if you want to kick off your javascript when the page loads, you can use the $(document).bind(‘load’, function(){}); routine.

Jack, what I would like to do is “auto” prepend a code snippet before the closing tag . The auto prepend code would exist in a seperate js file linked to the template.

sIFR, Google Analytics and many other scripts need to have a code snippet applied as well before the closing tag in order to work. It is mainly a script tag like:

What I want that for? I am preparing an extension for Joomla (which I hope to incorporate in your CMS as well when it comes out if it’s possible ) and would like the user to simply install the extension and have it run immediately without copy pasting any additional code in their joomla template. I like the keep-it-simple rule for such extensions and this is why I want to try JQuery.

Using the Joomla API I can “make” the extension auto include all necessery links to files used, as well as the JQuery library and an external js file that would include the “auto prepend” code that I’m talking about.

Don’t understand how this things can be applied in joomla.
I have copied the jquery and jq-corner javascript files in template root, but i don’t know what is the next step to make modules appear as rounded…
If someone can explain…
Thanks.

Amazingly clean final codes. Thanks, Jack. I will implement into my project.

BTW, for the jQuery plugin for rounded corners without images, I believe the author draws every rounded corner with many 1px-height divs line by line, whose width is defined by a math-function (sin, cos, sqrt). Just like a scientific x-y plotter.

OK, I do like this code and it is very simple and easy to use. However I am having problems trying to float elements within the roundbox div class and have tried and tried to get this to work. If anybody has any ideas or has also experienced this problem can you please offer me any advice. Have already tried the obvious.

Please could someone explain how I can implement Jquery in Joomla (Like from downloading jquery, to where to put it, what other files are needed, and how to link it all up)…’cos it’s not working for me, and there aint any info like that on the net!

I guess the only drawback to this approach is that it doesn’t work with transparent backgrounds on the bitmaps. Seems like, if you could clip the tl, ml and bl bitmaps it would work. Is there a way to do that?

This is pretty cool but I’m having trouble with this working in IE8. Seems the round corners will only work in IE8 if its ran in compatibility mode. I’m using jQuery corner plugin v1.7. Is there a newer version?

I do agree with your views on Rounded Corners With Javascript (jQuery) by 15 Days Of jQuery ? Although most of the information provided is true as per my knowledge but I don’t agree fully. I think it should be more practical. I visited your website wh…

hi, i’m new user of jQuery, so can anyone please help me to understand how to apply this coding into my DotNet website.??
i’m having a problem in getting it right , i do not know from where to get a library for any specific jQuery coding

[...] you wanted to use fancy images to produce round corners yet avoid extra mark-up, you could use this technique. Alternatively use no images at all via the jQuery corner plugin, available here. The [...]

Thanks for the thoughts you are discussing on this blog site. Another thing I’d really like to say is the fact that getting hold of copies of your credit file in order to look at accuracy of any detail is one first measures you have to execute in credit improvement. You are looking to thoroughly clean your credit report from harmful details problems that damage your credit score.

Pretty section of content. I just stumbled upon your weblog and in accession capital to assert that I get actually enjoyed account your blog posts. Anyway I will be subscribing to your augment and even I achievement you access consistently rapidly. que es el acne

Could I just say what a help to search out someone who essentially knows what they’re discussing on the web. You certainly have learned to bring a difficulty to light and enable it to be very important. More people need to read it all and understand it aspect of the story. I can’t believe you’re not very popular as you absolutely have the gift.

I think this is among the most vital information for me. And i’m glad reading your article. But want to remark on some general things, The website style is great, the articles is really great : D. Good job, cheers rutgers webreg

Someone essentially help to make significantly posts I’d state. That is the very first time I frequented your web page and up to now? I surprised with the analysis you made to make this particular publish extraordinary. Magnificent process!

Hello! I am trying to look at the example in this tutorial, but the page is not found. Will the example be re-posted to a new URI? I find the examples extremely helpful, as I am a visual and kinetic learner.

I as well as my friends have already been reading the best helpful tips on your web site and so then got a terrible suspicion I never expressed respect to the site owner for them. Most of the boys had been consequently thrilled to study them and already have surely been tapping into these things. Appreciation for really being really helpful and also for deciding on some incredibly good ideas millions of individuals are really needing to know about. Our own honest regret for not expressing gratitude to you sooner.

I was hunting on google and I stumbled on your web-site. Good page you might have right here. I’ve shared it to my good friend who was looking for these information. I am quite sure this may benefit him plenty.

Thanks a lot for giving everyone an extraordinarily spectacular chance to read from here. It’s usually so lovely and as well , jam-packed with amusement for me and my office colleagues to visit your blog the equivalent of 3 times in a week to read the new stuff you will have. And lastly, I’m just certainly fascinated with the dazzling things served by you. Selected two ideas in this post are in fact the most effective I’ve ever had.

My wife and i were quite cheerful that Jordan could round up his inquiry with the precious recommendations he discovered through the web page. It is now and again perplexing to simply happen to be releasing guides some other people might have been selling. And we also see we’ve got the website owner to thank because of that. All of the explanations you made, the simple blog navigation, the friendships your site make it possible to engender – it’s mostly wonderful, and it’s really facilitating our son and the family do think this idea is awesome, and that is very essential. Thanks for the whole lot!

Hi Guys,
From what I understand you can just round of the top left and top right corner of a background color and not all 4 corners if you so wish. I would like to create a tab using this script. Could anyone suggest how? The docs in jQuery Corners 0.3 refers to:

“top
right
bottom
left
top-left
top-right
bottom-left
bottom-right
Mix and match to round only specific corners.”

How exactly do I add these options to achieve a tab with just top left and top right corners rounded? Basic explanation please.
THANKS

Magnificent goods from you, man. I’ve understand your stuff previous to and you are just extremely great. I really like what you have acquired here, really like what you are stating and the way in which you say it. You make it entertaining and you still take care of to keep it wise. I can not wait to read much more from you. This is really a tremendous web site.

Maybe you have thought about building an ebook or maybe client publishing upon different weblogs? I have a blog page according to the same details you actually talk about and also so want to maybe you have reveal quite a few stories/information. I do know my best members might price your career. In case you are sometimes a little bit interested, do send everyone a contact.

Unfortunately, there are several types of remark junk e-mail which have become uncontrollable during the last couple of years, also as blog owners should be aware of these unsolicited mail tactics, attempt to discover them, and level people comments because junk utilizing their remark spam prognosis device (for instance, Akismet). Identifying remarks as unsolicited mail assists your spam device far better identify these individuals later on, so with luck ,, they will won’t complete for your moderateness queue any more.

[...] you wanted to use fancy images to produce round corners yet avoid extra mark-up, you could use this technique. Alternatively use no images at all via the jQuery corner plugin, available here. The [...]

Great goods from you, man. I have remember your stuff prior to and you are simply too wonderful. I actually like what you’ve acquired here, really like what you are stating and the best way during which you say it. You’re making it enjoyable and you still care for to stay it smart. I can not wait to learn far more from you. This is really a wonderful website.