Posted By

gerhardsletten on 10/13/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Rounded corners on images with jquery


 / Published in: jQuery
 

You can't add rounded corners on images with css, but this is a fix.

Markup:

CSS: .rounded {border-radius: 8px;}

  1. jQuery(document).ready(function () {
  2. $('.fx-img').each(function(){
  3. var me = $(this);
  4. var img = $('img',me);
  5. me.css('background', 'url('+img.attr('src')+') no-repeat');
  6. me.css('display', 'block');
  7. if(img.height() && img.width()) {
  8. me.height(img.height());
  9. me.width(img.width());
  10. }
  11. img.hide();
  12. });
  13. });

Report this snippet  

You need to login to post a comment.