图像地图上的onmouse enter和onmouseleave无法通过IE11或Edge正确触发,但可与其他浏览器一起使用

问题描述 投票:1回答:1

这是我认为已解决的上一个问题的延续。从技术上来说,这已为其他浏览器解决,所以我认为作为一个包含其他issue链接的新问题可能会更好。

可以查看到该网页的链接here

所以这是我的图像映射的代码:

    <div class="tech-interactive-banner">

      <img id="image-map" tooltip="Click Me" src="<?php echo $main_graphic['url']; ?>" alt="<?php echo $main_graphic['alt']; ?>" usemap="#image-map">

      <map name="image-map" class="image-map-class">
        <area class="automation-map" onmouseover="openAutomation()" onmouseleave="closeAutomation()" coords="304,559,1011,148,1143,229,1518,447,1516,485,1463,497,1444,510,1436,522,1241,636,1159,716,1076,762,959,801,813,884,494,696,304,589" shape="poly"> 
        <area class="integration-map" onmouseover="openIntegration()" onmouseleave="closeIntegration()" coords="1571,477,1456,494,1418,566,1088,756,871,881,868,916,1006,993,1229,1074,1274,1063,1348,1021,1483,944,1629,856,1793,761,1848,732,1881,701,1879,686,1703,551" shape="poly">
      </map>

    </div>

这里是Javascript代码。我已在代码中启用注释:

  function openAutomation(){
    console.log("openAutomation");
    $('#image-map').attr('src', automation);
    $('#automationModal').modal('show');
  };

  function openIntegration() {
    console.log("openIntegration");
    $('#image-map').attr('src', integration);
    $('#integrationModal').modal('show');
  };


  function closeAutomation(){
    console.log("closeAutomation");
    $('#image-map').attr('src', original);
    $('#automationModal').modal('hide');
  };

  function closeIntegration() {
    console.log("closeIntegration");
    $('#image-map').attr('src', original);
    $('#integrationModal').modal('hide');
  };

同样,您可能在上一期中看到,似乎可以解决onmouseover-onmouseleave-onmouseover触发的问题是在[[.modal-backdrop,.modal,.modal-content

类中添加了pointer-events: none !important 如果使用的是Firefox或Chrome,则可以正常运行。基本上,如果将鼠标悬停在图像的一部分上,则会弹出一个引导程序模版;如果将鼠标悬停在图像的同一部分,则会隐藏该引导程序模版。在IE / EDGE中,它总是触发鼠标悬停,但是当您尝试并离开鼠标时,它不会触发99%的时间

这是我认为已解决的上一个问题的延续。从技术上来说,该问题已为其他浏览器解决,因此我认为作为一个包含其他问题的链接的新问题可能会更好。链接...

javascript twitter-bootstrap-3 onmouseover imagemap pointer-events
1个回答
0
投票
找到了我的答案here。谢谢朱莉。基本上我需要做的就是用onmouseout替换onmouseleave,并且效果很好
© www.soinside.com 2019 - 2024. All rights reserved.