且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

引导程序弹出窗口显示错误的元素

更新时间:2023-11-23 08:25:28

selector属性仅在由插件触发时才用于委托事件.

The selector attribute only serves for delegated events if triggered by the plugin.

首先,此选择器 将如果设置trigger: 'manual',则不使用 .

First of all, this selector will not be used if you set trigger: 'manual'.

然后,如果(例如)您拥有trigger: 'hover'并具有该标记:

Then, if (for example) you have trigger: 'hover' and have that markup :

<div class="megadiv">
    <button class="btn">Hover me</button>
</div>

以下javascript将绑定一个弹出窗口,以显示在任何悬停的.btn

The following javascript will bind one popup to appear on any hovering .btn

$('.megadiv').popover({
    selector: '.btn',
    content: 'content',
    title: 'title'    
});

实时演示(jsfiddle)

这仅适用于.megadiv的子元素.为此,请参见 jQuery.on文档.

And this only applies to child elements of .megadiv. See the jQuery.on doc for that.

当事件直接发生在绑定元素上时,不调用处理程序,而仅对与选择器匹配的后代(内部元素)进行调用.

The handler is not called when the event occurs directly on the bound element, but only for descendants (inner elements) that match the selector.