简体   繁体   English

Qtip2没有显示

[英]Qtip2 not showing up

I'm working on qtip2 with jquery2 and based on the source code the tooltip actually gets created and added at the end of the page DOM/HTML like so: 我正在使用jquery2处理qtip2,并根据源代码实际创建并在页面DOM / HTML的末尾添加了工具提示,如下所示:

<div id="qtip-38" class="qtip qtip-default  qtip-pos-tl" tracking="false" role="alert" aria-live="polite" aria-atomic="false" aria-describedby="qtip-38-content" aria-hidden="true" style="display: none;"><div class="qtip-tip" style="background-color: transparent !important; border: 0px !important; height: 8px; width: 8px; line-height: 8px;"><canvas style="background-color: transparent !important; border: 0px !important;" height="8" width="8"></canvas></div><div class="qtip-content" id="qtip-38-content" aria-atomic="true">Hello</div></div>

Here is how the anchor is rendered (DOM/HTML changed to): 这是锚的呈现方式(将DOM / HTML更改为):

<a href="/wiki/Werner_Heisenberg" data-hasqtip="true" aria-describedby="qtip-38">Werner Heisenberg</a>

But when I hover over the link nothing gets shown. 但是,当我将鼠标悬停在链接上时,没有显示任何内容。

My original code; 我的原始代码;

<a href="/wiki/Werner_Heisenberg">Werner Heisenberg</a>

What could be wrong? 有什么事吗

I'm also using the twitter bootstrap (with all included javascript plugins) and laravel4 blade templating system. 我还使用了twitter引导程序(包含所有随附的javascript插件)和laravel4刀片模板系统。


I downloaded my qtip2 from http://qtip2.com/v/stable/ and used both the minified version for css and js. 我从http://qtip2.com/v/stable/下载了我的qtip2,并将缩小版的css和js都使用了。
I have checked my source code and it has properly referenced both the css and the js file. 我已经检查了我的源代码,并正确引用了CSS和js文件。


My Header: 我的标题:

{{ HTML::style('/bootstrap/css/bootstrap.css') }}
{{ HTML::style('/bootstrap/css/bootstrap-responsive.css') }}
{{ HTML::style('/js/qtip2/jquery.qtip.min.css') }}
{{ HTML::style('/js/datatables/css/jquery.dataTables.css') }}
{{ HTML::style('/bootstrap/css/style.css') }}

My JS found below everything: 我的JS在所有内容下面找到了:

{{ HTML::script('//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js') }}
{{ HTML::script('/bootstrap/js/bootstrap.js') }}
{{ HTML::script('/js/qtip2/jquery.qtip.min.js') }}
{{ HTML::script('/js/datatables/jquery.dataTables.min.js') }}
{{ HTML::script('/js/initialize.js') }}

Initialize.js: Initialize.js:

// Create the tooltips only on document load
$(document).ready(function()
{

        //this actually works with the carousel of twitter bootstrap
    $('#myCarousel').carousel({
        interval: 5000
    });
    $('#myCarousel').carousel('cycle');

        //this gets called too because the tooltip code is added to the site but it just doesn't show up when i hover on the link
    $('a').qtip({
        content: 'Hello'

    });


});

You must be getting some error in the console. 您必须在控制台中遇到一些错误。 qtip relies on $.browser which was removed after 1.8.3 version of jquery. qtip依赖于$.browser ,它在1.8.3版本的jquery之后被删除。

See the code from qtip.js it must be failing on moz = $.browser.mozilla, 请参阅qtip.js中的代码,它必须在moz moz = $.browser.mozilla,上失败moz = $.browser.mozilla,

function parseRadius(corner) {
        var isTitleTop = elems.titlebar && corner.y === TOP,
            elem = isTitleTop ? elems.titlebar : elems.content,
            moz = $.browser.mozilla, //<-- Failing here?
            prefix = moz ? '-moz-' : $.browser.webkit ? '-webkit-' : '',
            nonStandard = 'border-radius-' + corner.y + corner.x,
            standard = 'border-' + corner.y + '-' + corner.x + '-radius',
            css = function(c) { return parseInt(elem.css(c), 10) || parseInt(tooltip.css(c), 10); },
            val;

        whileVisible(function() {
            val = css(standard) || css(prefix + standard) || css(prefix + nonStandard) || css(nonStandard) || 0;
        });
        return val;
    }

Download jquery-migrate in git , to patch the backward compatibility and add it along. git中下载jquery-migrate,以修补向后兼容性并一起添加。

here is a fiddle where it works after including jquery-migrate. 这是一个包含jquery-migrate后的小提琴。

Demo 演示版

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

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