我有一张包含红点的世界地图,当您将鼠标悬停在这些点上时,会显示一个国家列表(可能是 1 个或多个)列表中的所有项目都是指向库存页面上某个部分的链接。
我只是在学习 jquery,所以我面临一些问题,也许有人可以帮助我:
- 我需要国家列表根据高度或国家行自动调整大小
- 一次应该只显示一个列表。
- 一旦我将鼠标悬停在一个点上并显示国家/地区,然后将鼠标移出它就无法再次工作,直到我刷新页面
- 我的 jquery 代码有意义吗,有没有更好的方法?
这是 html 部分中大多数 div 的样子:
<div id="austDiv32">
<img class="dot5" src="../images/dot.png" alt="Austria" style="margin: 80px 0 0 450px;" />
<div id="Div32" class="theDiv" style="margin: 20px 0 0 460px;">
<a href="availability.aspx?region=Austria" class="style1">Austria/a>
<a href="availability.aspx?region=Czech_Republic-Hungary"class="style1">
CzechRepublic<br />Hungary</a>
<a href="availability.aspx?region=Serbia" class="style1">Serbia</a>
</div>
</div>
这是 jquery 的样子:
$(function () {
$(".dot").mouseover(function () {
$(this).parent().children("div").animate({ height: "130px" }, 1000).css("visibility", "visible").delay(3000);
});
$(".dot").mouseout(function () {
$(this).parent().children("div").fadeOut(600).removeClass(".theDiv");
})
$(".dot2").mouseover(function () {
$(this).parent().children("div").animate({ height: "18px" }, 1000).css("visibility", "visible").delay(1000);
});
$(".dot2").mouseout(function () {
$(this).parent().children("div").fadeOut(600).removeClass(".theDiv");
});
$(".dot3").mouseover(function () {
$(this).parent().children("div").animate({ height: "30px" }, 1000).css("visibility", "visible").delay(1000);
})
$(".dot3").mouseout(function () {
$(this).parent().children("div").fadeOut(600).removeClass(".theDiv").end();
});
$(".dot4").mouseover(function () {
$(this).parent().children("div").animate({ height: "50px" }, 1000).css("visibility", "visible").delay(1000);
})
$(".dot4").mouseout(function () {
$(this).parent().children("div").fadeOut(600).removeClass(".theDiv");
});
$(".dot5").mouseover(function () {
$(this).parent().children("div").animate({ height: "70px" }, 1000).css("visibility", "visible").delay(1000);
})
$(".dot5").mouseout(function () {
$(this).parent().children("div").fadeOut(600).removeClass(".theDiv");
});
$(".dot6").mouseover(function () {
$(this).parent().children("div").animate({ height: "145px" }, 1000).css("visibility", "visible").delay(1000);
})
$(".dot6").mouseout(function () {
$(this).parent().children("div").fadeOut(600).removeClass(".theDiv");
});
});
</script>