admin管理员组文章数量:1391934
I am using Twitter Bootstrap popover and I don't know how would be able to change the popover location dinamic while resizing browser window. The problem is that when i resize the window, popover stays fixed on position. I want to delay the popover like other html elements.
Code:
$('#popover1').popover({
html : true,
content: function() {
return $("#form").html();
},
placement: "top"
});
I am using Twitter Bootstrap popover and I don't know how would be able to change the popover location dinamic while resizing browser window. The problem is that when i resize the window, popover stays fixed on position. I want to delay the popover like other html elements.
Code:
$('#popover1').popover({
html : true,
content: function() {
return $("#form").html();
},
placement: "top"
});
Share
Improve this question
edited Dec 4, 2013 at 18:30
Mike Atlas
8,2414 gold badges47 silver badges63 bronze badges
asked Jun 19, 2013 at 21:02
ErikErik
3352 gold badges9 silver badges19 bronze badges
2
-
$(window).on('resize', function() { /* reposition popover here */ });
– BenM Commented Jun 19, 2013 at 21:03 - Solution : github./twbs/bootstrap/issues/3117 – user Commented May 29, 2014 at 17:54
2 Answers
Reset to default 3This works for me. It calls the show
event for all visible popovers:
$(window).off("resize").on("resize", function() {
$(".popover").each(function() {
var popover = $(this);
if (popover.is(":visible")) {
var ctrl = $(popover.context);
ctrl.popover('show');
}
});
});
Have a look at the following questions and answers:
- Bootstrap Popover showing at wrong place upon zoom in/out or resizing Browser window
- jQuery position element based on window resize
You need to use an event handler for the resize event:
$(window).resize(function() {
// your positioning code here
});
Within this code you must reposition your element.
本文标签: javascriptChange the popover location dynamically while resizing browser windowStack Overflow
版权声明:本文标题:javascript - Change the popover location dynamically while resizing browser window - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744744409a2622800.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论