最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I use the "live" feature of bootstrap's popovers? - Stack Overflow

programmeradmin1浏览0评论

In the old days, bootstrap's popover had a "live" option which allowed us to make the $('.myclass').popover({live: true}) call even before the DOM elements existed. I looked at the docs for 2.2 and this seems to be gone. What's the new way to do it?

In the old days, bootstrap's popover had a "live" option which allowed us to make the $('.myclass').popover({live: true}) call even before the DOM elements existed. I looked at the docs for 2.2 and this seems to be gone. What's the new way to do it?

Share Improve this question edited Nov 5, 2012 at 9:39 Florent 12.4k10 gold badges50 silver badges58 bronze badges asked Nov 4, 2012 at 5:17 Paul BiggarPaul Biggar 28.8k24 gold badges103 silver badges155 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

The live mode is not used any more.

The Bootstrap JS plugins now use delegated events via the jQuery .on method. You can supply an event delegation target selector pointing to an element which might or might not exist.

$('.some-container').popover({
  selector: '.has-popover'
});

Working example generating DOM elements with popover attached: http://jsfiddle/asKF9/

发布评论

评论列表(0)

  1. 暂无评论