为什么我的Bootstrap JavaScript无法正常工作? [英] why does my Bootstrap javascript not work?

查看:73
本文介绍了为什么我的Bootstrap JavaScript无法正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过其他问题并仔细检查.我的javascript资源井井有条,没有路径问题,我什至在我的页面上也有jquery项目.为了测试,我将这些代码放在社交媒体图标"标题的上方,但仍然一无所获.

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. 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');
        }
    });

});

推荐答案

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

From the Bootstrap docs.. (http://getbootstrap.com/javascript/#tooltips)

出于性能方面的考虑,Tooltip和Popover数据API是可选的,这意味着您必须自己对其进行初始化."

"For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning you must initialize them yourself."

因此,您需要添加此jQuery.

So you need to add this jQuery..

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

初始化工具提示.

这篇关于为什么我的Bootstrap JavaScript无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆