【发布时间】:2012-11-08 10:59:30
【问题描述】:
我用 jquery 编写了一些代码,可以在 firefox、safari 和 ie9 中使用。但铬不喜欢它。 chrome 控制台中没有明显的消息。我正在碰壁,希望有人能有所启发。脚本只是显示/隐藏一些工具提示。有任何想法吗? 在这里摆弄,改变的代码仍然没有改变行为。
$(document).ready(function(){
//custom toolTip Written by CASherwood but not working in ie9/chrome
var ShowId;
var id;
var contentholder = $(".contentBox");
var toolTip = $(".info");
var idHashString = '#info';
var idString = 'id';
function showToolTip(name, id){
id = name + id;
$(id).fadeIn(1000);
}
function hideToolTip(name, id){
id = name + id;
$(id).fadeOut(1000);
}
$(toolTip).mouseover(function(){
ShowId = $(this).attr(idString);
showToolTip(idHashString, ShowId);
});
$(contentholder).mouseleave(function(){
ShowId = $(this).find('.info').attr(idString);
hideToolTip(idHashString, ShowId);
});
});
【问题讨论】:
-
你能提取一些html并在这里发布吗?或者把它放到一个 jsfiddle 中也许有助于测试。
-
LOL - this other question 正好相反:P 仅适用于 chrome...也许你们两个应该见面;)
-
拜托你能建立一个问题的演示,也许在jsFiddle?该问题不包含任何有助于澄清问题的标记
-
小提琴在 Chrome 中对我来说工作正常。将鼠标悬停在 i 字符上时,我看到了工具提示。我确实看到您正在使用以数字开头的
id属性,该数字仅对 HTMl5 doctype 有效,但这不应导致它在 Chrome 中不起作用。您使用的是哪个版本的 Chrome?我正在使用 24.0.1312.5 dev-m -
嗨,我将它作为一个小部件嵌入到学习环境(黑板)中,我认为这是问题所在。对的痛!认为我需要使用 noConflict();
标签: javascript jquery google-chrome