Hai*_*ood 2 javascript jquery jquery-ui jquery-plugins jquery-ui-widget
我正在编写一个jquery UI小部件,它简单地包装了bootstrap popover插件.在小部件中你可以传递选项'singular',如果传入它,那么它应该调用插件的所有其他实例的函数.
就像是
$('#one').myWidget();
$('#two').myWidget();
$('#three').myWidget();
$('#four').myWidget();
$('#one').myWidget('show'); //stuff from widget one is now visible
$('#two').myWidget('show'); //stuff from widget one and two are now visible
$('#three').myWidget('show'); //stuff from widget one, two and three are now visible
$('#two').myWidget('hide'); //stuff from widget one and three are now visible
$('#four').myWidget('show', {singular:true}); //stuff from widget four is now visible
所以,我认为show函数看起来像:
show: function(options){
    options = options || {};
    if(options.singular){
        var instances = '????'; // how do I get all instances?
        $.each(instances, function(i, o){
            o.myWidget('hide');
        });
    }
    this.element.popover('show');
}
所以,问题是,如何获得对其上包含myWidget小部件的所有元素的引用?
| 归档时间: | 
 | 
| 查看次数: | 4610 次 | 
| 最近记录: |