Bootstrap Popover不会显示:错误,请在可见元素上使用show

问题描述 投票:1回答:1

我创建了一个弹出窗口,当您单击指定区域并带有相应的data-toggle时将启动该弹出窗口,它在Chrome浏览器中运行正常,但在Firefox中,我不断收到错误消息:

错误:请在可见元素上使用show 显示,_enter,切换,_setListeners,调度,句柄

错误驻留在我的项目中使用的bootstrap.min.js文件中。

现在我知道这可能与在('show')部分之后添加.popover有关,但是我无法使其正常工作。我的弹出功能:

 // popover initialization - on click
        $('[data-toggle="zero-1"]').popover({
          html: true,
          trigger: 'click',
          placement: 'bottom',

          // main function when popover fires
          content: function engine() {
           
            // execute the actions of the lawmaker() first, then the ruler()
            return lawmaker(this,this,this) + ruler((($(this).data('xray'))),(($(this).data('yray'))));

            // insert image and close button in popover
            function lawmaker(i1,a1, b1,) {

               // get the data-image str value
               var mig = $(i1).data('img');
               // console.log(mig);

               // return the visuals and close button for the popover
               return '<img src="' + mig + '" /> <button id="close-popover" data-toggle="clickover" class="btn btn-small btn-primary pull-right" onclick="$(\'.popover\').remove();">Close please!</button>'; 
         }
          }
        });
    
.popover {
    position: absolute;
    transform: translate3d(258px, 63px, 0px);
    top: 0px;
    left: 0px;
    will-change: transform;
    }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<map>
<area class="grz" data-toggle="zero-1" data-xray="105" data-yray="70" shape="rect" coords="80,60,130,80" href="javascript://" data-img="img/zero/zero-2.png" title="Zero">
</map>

解决这个问题有什么想法吗? :)

javascript jquery twitter-bootstrap firefox dom
1个回答
0
投票

[当我尝试通过js初始化工具提示时,工具提示不起作用,但是也没有错误。当我执行$(element).tooltip()。tooltip('show')时,出现此错误。这是发生这种情况的可能原因的链接https://github.com/twbs/bootstrap/issues/24918

我最终只是将html属性放在工具提示元素上以使其起作用-帮助

© www.soinside.com 2019 - 2024. All rights reserved.