简体   繁体   English

为什么我的Bootstrap JavaScript无法正常工作?

[英]why does my Bootstrap javascript not work?

I have looked at the other questons and double checked. 我看过其他问题并仔细检查。 My javascript resources are in order, there are no path problems, i even have jquery items working on my page. 我的javascript资源井井有条,没有路径问题,我什至在我的页面上也有jquery项目。 I thew this code right above the "Social Media Icons" heading for the sake of testing and still nothing. 为了测试,我将这些代码放在“社交媒体图标”标题的上方,但仍然一无所获。

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</button>

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button>


$(document).ready(function () {        

    $('#section-nav a').tooltip();

    $(".tab").tabs();


    $(".tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *")
      .removeClass("ui-corner-all ui-corner-top")
      .addClass("ui-corner-bottom");

    // move the nav to the bottom
    $(".tabs-bottom .ui-tabs-nav").appendTo(".tabs-bottom");

    $('.navbar-toggle').click(function () {
        var target = $('#navigation .shopbar');

        if (target.hasClass('border-bottom')) {
            target.removeClass('border-bottom');
        } else {
            target.addClass('border-bottom');
        }
    });

});

From the Bootstrap docs.. ( http://getbootstrap.com/javascript/#tooltips ) 来自Bootstrap文档。( http://getbootstrap.com/javascript/#tooltips

"For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning you must initialize them yourself." “出于性能方面的考虑,工具提示和Popover数据API是可选的,这意味着您必须自己对其进行初始化。”

So you need to add this jQuery.. 因此,您需要添加此jQuery。

$("[data-toggle=tooltip]").tooltip();

To initialize the Tooltips. 初始化工具提示。

data-original-title更改为title ,然后:

$('#section-nav a').tooltip();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM