Created
July 7, 2014 08:54
-
-
Save Unifex/708b31fc3e9a06671c0e to your computer and use it in GitHub Desktop.
I was wanting to have a Bootstrap/Bootswatch well with a background image instead of dropping the image inside, using css to jam it in in the right shape (rounded corners, etc) and trying to overlay the content in that. This was how I got around it. I suspect there's a better way of doing it (especially something with responsive images) but it's…
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="well well-lg" data-well-bg="path/to/image"> | |
Content and stuff. | |
</div> |
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
jQuery(document).ready(function($) { | |
$('.well').each(function () { | |
var data = $(this).data('well-bg'); | |
if (data) { | |
$(this).css('background-image', 'url(' + data + ')'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment