Welcome!

My name is Manmohanjit Singh and I’m 15 this year. Sorry you’ll just have to accept it, I may be a kid to you but trust me I’m not. I live in Malaysia and I go to school at SMK USJ 12. Read more...

Twitter

  • Loading...

@manmohanjit

Recent Tracks

  • Loading...

manmohanjit1

# [Snippet] Rounded corners on all images using jQuery

by Manmohanjit Singh on Jun 8th, 2010 in Tutorial.

Ever wanted rounded corners on all images in your post? With CSS3 and a little bit of jQuery, its now possible.

Here’s the code snippet:

$(document).ready(function(){
	$('img').each(function(){
		$(this).load(function(){
			$(this)
				.css('display', 'block')
				.css('width', $(this).width())
				.css('height', $(this).height())
				.css('background', 'url('+$(this).attr('src')+') no-repeat')
				.css('-webkit-border-radius', '10px')
				.css('-moz-border-radius', '10px')
				.css('border-radius', '10px')
				.attr('src', '')
				.attr('alt', '');
		});
	});
});

View it here.

Tags:

No comments

  • No comments yet...

Leave A Comment

I'm watching you, please be nice and try not to spam. Comments are moderated. You can paste links directly, it will be formatted automatically. Basic XHTML tags are allowed.

Oh, I almost forgot. Comments are powered by Ajax, so don't hit the submit button twice. Thanks!

Wait for 15 seconds...