Last active
August 27, 2015 20:21
-
-
Save japsu/2c2b4760290a17859b66 to your computer and use it in GitHub Desktop.
Show img[alt] in a Bootstrap 3 popover without any extra markup (doesn't break floats etc)
This file contains hidden or 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
(function($) { | |
$('img[alt]').each(function() { | |
var $this = $(this); | |
$this | |
.attr('data-content', $this.attr('alt')) | |
.hover(function() { | |
$(this).popover('show'); | |
}, function() { | |
$(this).popover('hide'); | |
}); | |
}).popover({ | |
trigger: 'manual', | |
placement: 'bottom auto', | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment