Rounded corners on images with jquery


/ Published in: jQuery
Save to your folder(s)

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

Markup:




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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.