Last active
August 29, 2015 14:20
-
-
Save smallmake/11e14018363d69fe7a00 to your computer and use it in GitHub Desktop.
JQuery: Bootstrap popover のcontent htmlの手動セットとcloseボタン設置
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
# samenames_html is html to display in popover | |
if (samenames_html.length > 0) { | |
$("#popoverSameNames").popover({ | |
title: '同姓同名があります.<span class="close">×</span>', | |
template: '<div class="popover" role="tooltip" style="width:500px;font-size:80%;"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"><div class="data-content"></div></div></div>', | |
html: true | |
}).on('shown.bs.popover', function(e){ | |
var popover = $(this); | |
$(this).parent().find('div.popover .close').on('click', function(e){ | |
popover.popover('hide'); | |
}); | |
}); | |
$("#popoverSameNames").data('bs.popover').options.content = samenames_html; | |
$("#popoverSameNames").popover('show'); | |
} else { | |
$("#popoverSameNames").data('bs.popover').options.content = ""; | |
$("#popoverSameNames").popover('hide'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
以下を参照ください
https://smallmakeprgnote.wordpress.com/2015/03/28/jquery-bootstrap-popover-%E3%81%AEcontent-html%E3%81%AE%E6%89%8B%E5%8B%95%E3%82%BB%E3%83%83%E3%83%88%E3%81%A8close%E3%83%9C%E3%82%BF%E3%83%B3%E8%A8%AD%E7%BD%AE/