JQuery image.mapster 与其他 jquery 版本发生冲突

JQuery image.mapster with other jquery version clash

本文关键字:版本 冲突 jquery 其他 image mapster JQuery      更新时间:2023-09-26

我面临着image.mapster jquery在图像中悬停自定义div与其他用于缩小和放大按钮单击的jquery版本之间的jquery冲突。

以下是我面临的查询:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js"></script>
<script type="text/javascript" src="../dist/jquery.imagemapster.js"></script>

如果我按照上面的顺序编写代码,image.mapster jquery 将在悬停时工作,但我的放大和缩小功能将不起作用。

如果我先使用 image.mapster 查询,然后编写第二个 jQuery,那么我得到错误作为方法image.mapster找不到。

我还创建了一个测试文件代码http://jsfiddle.net/vpd1Lbtp/3/但是在 JSFIDDER 中它可以部分工作,但图像的大小没有放大和缩小。我也在 HTML 代码中编写相同的内容,只有一个功能有效

如果在缩放时检查img#vegetables,您将看到要缩放的代码,它实际上正在运行。但是,Mapster 已将图像的不透明度设置为 0。您正在查看的图像是Mapster创建的图像,带有class="mapster_el"

我认为您可以通过缩放.mapster_el而不是#vegetables来获得所需的功能:

$('.mapster_el').stop(true, true).animate({
//etc...

这将缩放复制的图像以及表示地图的canvas元素。