我有一个带有300-400个多边形区域的图像映射,在事件“onclick”上应该突出显示该区域并获取一些数据等...当页面加载时(我的图像有点大,3-5MB),所以我使用davidjbradshaw/image-map-resizer插件调整了这些图像映射的大小。当我开始实现突出显示方法时,一切都正常,但在缩放图像后,我的多边形坐标会出错。如果我删除突出选项并缩放图像,我的多边形坐标将被调整为适当的图像大小。
JS代码用于调整大小(正常工作)
$( document ).ready(function() {
imageMapResize();
});
function ZoomIn () {
$("img").animate({
height: '+=200',
width: '+=200'
}, 1000, function() {
imageMapResize();
});
}
function ZoomOut () {
$("img").animate({
height: '-=200',
width: '-=200'
}, 1000, function() {
imageMapResize();
});
}
JS代码用于调整/突出显示(未正常工作)
$( document ).ready(function() {
imageMapResize();
$('img[usemap]').maphilight();
});
function ZoomIn () {
$("img").animate({
height: '+=200',
width: '+=200'
}, 1000, function() {
imageMapResize();
$('img[usemap]').maphilight();
});
}
function ZoomOut () {
$("img").animate({
height: '-=200',
width: '-=200'
}, 1000, function() {
imageMapResize();
$('img[usemap]').maphilight();
});
}
没有缩放和高亮功能的图像调整器能够完美工作。
缩放后
我做错了什么?