Javascript IE与jQuery工具提示的兼容性
我已经开始使用jQuery工具的工具提示()设计页面 我对它做了一些修改,允许onClick show和onClick hide。在Chrome、Safari和Firefox中运行良好 但它在IE9上不起作用,尽管jquery工具应该是非常跨浏览器兼容的 我使用的脚本是:Javascript IE与jQuery工具提示的兼容性,javascript,jquery,cross-browser,tooltip,jquery-tools,Javascript,Jquery,Cross Browser,Tooltip,Jquery Tools,我已经开始使用jQuery工具的工具提示()设计页面 我对它做了一些修改,允许onClick show和onClick hide。在Chrome、Safari和Firefox中运行良好 但它在IE9上不起作用,尽管jquery工具应该是非常跨浏览器兼容的 我使用的脚本是: $(function() { // initialize tooltip var tooltip = $("#cog").tooltip({ tipClass: 'usermenu'
$(function() {
// initialize tooltip
var tooltip = $("#cog").tooltip({
tipClass: 'usermenu',
effect: 'slide',
bounce: true,
direction: 'down',
slideOffset: 10,
offset: [-5,-38],
delay: 500,
position: 'bottom center',
relative: true,
events: {
def: ",", // default show/hide events for an element
input: ",", // for all input elements
widget: ",", // select, checkbox, radio, button
tooltip: "," // the tooltip element
},
onBeforeShow: function() {
document.getElementById("cog_img").classList.toggle('inactive_cog_img');
document.getElementById("cog_img").classList.toggle('active_cog_img');
},
onHide: function() {
document.getElementById("cog_img").classList.toggle('inactive_cog_img');
document.getElementById("cog_img").classList.toggle('active_cog_img');
}
});
tooltip.click(function() {
var tip = $(this).data("tooltip");
if (tip.isShown(true))
tip.hide();
else
tip.show();
});
});
在哪里
#cog
是触发器,
usermenu
是工具提示DIV
为了现场观看,我制作了一个示例页面:
(请参见右上角的齿轮)
请帮助我找到一种方法,使其在IE中工作,或者让我知道是否有IE替代方案
谢谢 IE不喜欢那样。类列表属性。。。试试这个:
$('#cog_img').toggleClass("inactive_cog_img").toggleClass("active_cog_img");
与此相反:
document.getElementById("cog_img").classList.toggle('inactive_cog_img');
document.getElementById("cog_img").classList.toggle('active_cog_img');
我通过从usermenu div的内联样式中删除“opacity:0;”成功地实现了这一点。但是,您会遇到箭头覆盖齿轮图标的问题,使工具提示难以隐藏)我无法手动控制内联不透明度,因为jquery插件效果是改变它的一个因素。有什么办法吗?我已经在示例页面中更新了脚本。好像没修好=(