javascript - Maphilight 与 IE9 中的 Jquery 选项卡发生冲突

标签 javascript jquery google-chrome internet-explorer maphilight

有人吗?有什么线索吗??

我正在尝试在同一页面上创建两张具有高亮功能的 map 。这适用于所有现代浏览器(IE11、Chrome 等),但不适用于 IE9。您可以使用以下 fiddle 来证明这一点:http://jsfiddle.net/Guill84/Sws2T/13/

为了便于引用,我将启动插件的脚本粘贴在下面。是否有原因导致它在所有浏览器中都能正确加载,但在 IE9 中却不能?或者我的代码有问题?使用的插件是“Maphilight”( https://github.com/kemayo/maphilight )

提前致谢, G

$(function () {
    $('.map').maphilight({
        stroke: false,
        fillColor: 'D2D2D2',
        fillOpacity: 1
});
    $('.map2').maphilight({
        stroke: false,
        fillColor: 'D2D2D2',
        fillOpacity: 1
});

    //light up first element
    //this code is repeating below but not sure how to make more condensed
    var data = $(this).data('maphilight') || {};
    data.alwaysOn = true;
    $('.map, .map2').data('maphilight', data).trigger('alwaysOn.maphilight');
    // initialize tabbing
    $(".tabs area:eq(0)").each(function () {
        $(this).addClass("current");
    });
    $(".tab-content").each(function () {
        $(this).children(":not(:first)").hide();
    });
    $(".tabs area").each(function (o, i) {
        var d = $(this).data('maphilight') || {};
        d.fillOpacity = 1;
        d.alwaysOn = true;
        $(this).attr("rel", d.fillColor);
        $(this).data('maphilight', d).trigger('alwaysOn.maphilight');
    });
    $(".tabs area").hover(function () {
        var d = $(this).data('maphilight') || {};
        //d.fillOpacity=0.6;
        d.fillColor = "A0A0A0";
        $(this).data('maphilight', d).trigger('alwaysOn.maphilight');
    }, function () {
        var d = $(this).data('maphilight') || {};
        //d.fillOpacity=0.6;
        if (typeof d.clicked === "undefined" || d.clicked == false) {
            d.fillColor = $(this).attr("rel");
        } else {
            d.fillColor = "379ee0";

        }
        $(this).data('maphilight', d).trigger('alwaysOn.maphilight');
    });
    //map clicks
    $(".tabs area").click(function () {
        //areas loop:
        $(".tabs area").not(this).each(function (o, i) {
            var d = $(this).data('maphilight') || {};
            d.clicked = false;
            d.fillColor = $(this).attr("rel");
            if (d.alwaysOn === false) {
                //d.alwaysOn = false;
                $(this).data('maphilight', data).trigger('alwaysOn.maphilight');
            }
        });

        var data = $(this).data('maphilight') || {};
        data.alwaysOn = true;
        data.fillColor = "379ee0";
        data.clicked = true;
        $(this).data('maphilight', data).trigger('alwaysOn.maphilight');

        if ($(this).hasClass("current") === false) {
            var thisTarget = $(this).attr("href");
            $(this).parents(".tabs").find('area.current').removeClass('current');
            $(this).addClass('current');
            $(this).parents(".tabs").nextAll(".tab-content").children(":visible").fadeOut(1, function () {
                $(thisTarget).fadeIn("normal");
            });

        }
        return false;
    });
});

最佳答案

我认为问题不在于插件 jQuery Maphilight,而是另一个插件 - jQuery Panzoom,看来 Internet Explorer 版本低于 v.9不支持:

Panzoom uses CSS transforms and matrix functions to take advantage of hardware/GPU acceleration in the browser, which means the element can be anything: an image, a video, an iframe, a canvas, text, WHATEVER. And although IE<=8 is not supported, this plugin is future-proof.

查看此处了解详细信息 - https://github.com/timmywil/jquery.panzoom/blob/master/README.md

但是你说你用IE 9测试,你到底是如何进行测试的,这是正版IE 9还是你在模拟版模式下运行IE 11? 我可以确认,jsfiddle 代码在模拟模式下的 IE 9 下工作得很好,除了使用鼠标滚轮进行缩放之外,它仅适用于按钮 Zoom In/Zoom Out .

关于javascript - Maphilight 与 IE9 中的 Jquery 选项卡发生冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27127222/

相关文章:

javascript - 如何删除html标签和head标签之间的iframe标签?

javascript - 如何使用带有 html 和 css 的 javascript 或 jquery 将选定节点从一个 TreeView 复制到另一个 TreeView ?

javascript - 将 evt.data 从 websocket 转换为 jSON 字符串或 Javascript 中的纯字符串

javascript - 动态改变CSS样式中的图片

google-chrome - 为什么我无法获得 google chrome CSS Grid Inspector?

html - Unicode 图标 : sometimes looks like a wrong encoding

javascript - 来自 Chrome 扩展程序的 POST 请求

javascript - D3 js图中相同颜色的箭头和链接

javascript - 执行多次点击

javascript - 将 viewmodel 属性设置为列表中的项目