Skip to content

Instantly share code, notes, and snippets.

@koentjuh1
Last active August 30, 2016 11:12
Show Gist options
  • Save koentjuh1/9f8518803fe53ff0cf4cd7afebb61edc to your computer and use it in GitHub Desktop.
Save koentjuh1/9f8518803fe53ff0cf4cd7afebb61edc to your computer and use it in GitHub Desktop.
Replace image of <img> into css: background-image:url(''); to the parent.
$('.slider-block img').each(function() {
var imgSrc = $(this).attr('src');
$(this).parent().css({'background-image': 'url('+imgSrc+')'});
$(this).remove();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment