简体   繁体   English

Jquery Tooltip无法使用bootstrap js

[英]Jquery Tooltip not working with bootstrap js

I have created an angular directive for jquery tooltip. 我为jquery工具提示创建了一个angular指令。

angular.module("app", []).directive("tooltip", function(){
    return {
        restrict: "A",
        scope:{ 
            title: "@",
            template: "@"
        },
        link: function(scope, element){
            $(element).tooltip({
                title: scope.title,
                tooltipClass: scope.template
            });
        }
    }
})

Demo-1 is here and working.(not referenced bootstrap.js yet) Demo-1在这里工作。(尚未引用bootstrap.js)

But if I use bootstrap.js on my project, it is not working. 但是,如果我在我的项目中使用bootstrap.js,它就无法正常工作。

Demo-2 is here and not working. 演示2在这里 ,不起作用。 (I referenced bootstrap.js) (我引用了bootstrap.js)

Bootstrap.js is also having a tooltip feature named with tooltip function. Bootstrap.js还具有以tooltip功能命名的tooltip功能。 So it is overriding the tooltip function of the jQuery UI tooltip function. 所以这是压倒一切的tooltip的jQuery UI的功能tooltip功能。

If you have to use both jQuery UI and Bootstrap plugins but wants tooltip of jQuery UI, just include the bootstrap.min.js before the jquery-ui.min.js . 如果你必须使用jQuery UI和Bootstrap插件,但想要jQuery UI的工具提示,只需在jquery-ui.min.js之前包含bootstrap.min.js

Just for the heads up, Demo-2 is working: added position relative here 只是为了抬头,Demo-2正在工作: 在这里 added position relative

Just in-case you want to use it: tooltip options 只是在你想要使用它的情况下: 工具提示选项

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

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