我正在制作一个主控制页面,在图像上有不同的链接,现在唯一的问题是我希望图像适合整个页面并重新调整大小(窗口),如果它们缩小(在某种程度上)并放大它.
<img src ="image/main.jpg" style="width:100%;height:100%; min-width:600px; min-height:400px;" alt="Main" usemap="#MainMap">
<map name="MainMap">
<area id="login" class="login" shape="circle" coords="91,677,92">
<area id="money_management" class="money" shape="circle" coords="598,680,92">
<area id="withdraw_history" shape="circle" coords="596,304,67">
<area id="transaction_history" shape="circle" coords="784,624,67" href="History.html">
<area id="cart" shape="circle" coords="396,698,67,92">
<area id="buy" shape="circle" coords="898,352,92">
<area id="sell" shape="circle" coords="718,438,92">
<area id="new" shape="circle" coords="570,132,92" href="New.html">
</map>
Run Code Online (Sandbox Code Playgroud)
我之前有这个,当我使图像静态并让它在其他东西上工作时,我希望在重新调整窗口大小后更新坐标我知道如何在jquery中检测重新调整大小我找不到任何语法更新坐标的示例.
这是一个很棒的jQuery PlugIn,可以完全满足您的需求:
/*
* rwdImageMaps jQuery plugin v1.4
*
* Allows image maps to be used in a responsive design by recalculating
* the area coordinates to match the actual image size on load and
* window.resize
*
* Copyright (c) 2012 Matt Stow
* https://github.com/stowball/jQuery-rwdImageMaps
* http://mattstow.com
* Licensed under the MIT license
*/
Run Code Online (Sandbox Code Playgroud)
希望有所帮助