【问题标题】:jQuery maphilight not workingjQuery maphilight 不工作
【发布时间】:2017-06-19 19:02:45
【问题描述】:

我错过了什么?我正在使用David Lynch maphilight 插件,并且一直在将我的代码与此页面进行比较以进行故障排除,但两天后,我仍然遇到问题。当我将鼠标悬停在(甚至单击)映射图像的任何部分时,颜色不会显示。链接按预期工作。

我的脚本调用是:

   <head>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.maphilight.js"></script>
    <script type="text/javascript">$(function() {
        $('.AMGCmap1').maphilight();
    </script>
   </head>

而img和map的代码是:

            <div>
                <img class ="map" id ="AMGCmap1" src="Images\AMGC Logo Big.png" alt="AMGC Logo" usemap="#AGMCmap" border="15">

                <map name="AGMCmap">
                    <area shape="poly" coords="61,432, 58,346, 71,285, 148,287, 164,345, 166,432" href="news.html"  title= "News" data-maphilight='{"strokeColor":"0000ff","strokeWidth":5,"fillColor":"ff0000","fillOpacity":0.6}' >
                </map>

            </div>

我尝试在函数中使用 img ID 和“'.map'”,但没有发现任何区别。其他人有这样的问题吗?

我目前正在使用 Chrome,如果这有帮助的话。

【问题讨论】:

    标签: javascript jquery html css maphilight


    【解决方案1】:
    <img class ="map" id ="AMGCmap1" ...>
    

    在这里,您有一个 id,同时您正在脚本中调用一个类。

    $('.AMGCmap1').maphilight();
    

    这可能是问题所在。 将 HTML 中的 id 编辑为一个类:

    <img class ="map AMGCmap1" ...>
    

    或者在你的脚本中调用一个 id:

    $('#AMGCmap1').maphilight();
    

    不管怎样,即使我已经仔细检查了我的脚本,我也遇到了同样的问题,如果你能在修复后让它工作,请告诉我。

    【讨论】:

      猜你喜欢
      • 2016-06-01
      • 2023-04-10
      • 2012-01-26
      • 1970-01-01
      • 1970-01-01
      • 2012-11-24
      • 2010-12-18
      • 2011-01-31
      • 2017-09-12
      相关资源
      最近更新 更多