Created
September 25, 2012 20:35
-
-
Save beshur/3784280 to your computer and use it in GitHub Desktop.
jQuery Opera 50% border-radius for images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="content"><img src="http://placehold.it/250x250" /></div> | |
<style type="text/css"> | |
img { | |
border-radius: 50%; | |
} | |
.o-border-radius { | |
display: block; | |
border-radius: 50%; | |
overflow: hidden; | |
} | |
.o-border-radius img { display: none;} | |
</style> | |
<script style="text/javascript"> | |
$(function () { | |
if ($.browser.opera) { | |
$(".content img").each(function () { | |
if ( $(this).css("border-radius") == "50%" ) { | |
$(this).wrap('<div class="o-border-radius" style="background: url('+ $(this).attr("src") + ') 0 0 no-repeat; width: ' + $(this).width() +'px; height: ' + $(this).height() + 'px;"></div>'); | |
} | |
}) | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment