简体   繁体   English

使用图像地图调整大小

[英]using image map resizer

I found the following image map resizer so my image map will be responsive: 我找到了以下图像地图缩放器,因此我的图像地图会响应:

https://github.com/davidjbradshaw/image-map-resizer/blob/master/README.md https://github.com/davidjbradshaw/image-map-resizer/blob/master/README.md

Following the instructions I placed the following code in the head: 按照说明,我将以下代码放在头部:

<script src="imageMapResizer.min.js"></script>

<!--[if lt IE 9]>

<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>

<![endif]-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--[if lte IE 8]>
    <script type="text/javascript" src="js/ie8.polyfil.min.js"></script>
<![endif]-->

But I don't know where to place the code: 但是我不知道将代码放置在哪里:

imageMapResize([selector || map object]);

It says to put it at the bottom of the page. 它说要把它放在页面的底部。 I tried placing it inside of the and outside the tag but it's still not working. 我尝试将其放在标记的内部和外部,但仍然无法正常工作。 Where am I supposed to put it?? 我应该放在哪里?

If you have confusion using vanilla-javascript you could use jquery which is also supported by that library, put the below code: 如果您对使用vanilla-javascript感到困惑,则可以使用该库也支持的jquery,请输入以下代码:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

<script src="imageMapResizer.min.js"></script>
<script>
     $(document).ready(function() {
         $('map').imageMapResize();
     });
</script>

You "should" add the script-tag just before the closing body-tag (there are a lot great articles about that topic): 您应该“将”脚本标签添加在结束标签之前(有关该主题的文章很多):

    <script></script>
  </body>
</html>

Note, that you have to include a library before you "execute" it ;) 请注意,您必须先包含一个库,然后才能“执行”它;)

It seems your selector is wrong. 看来您的选择器有误。 Try this: 尝试这个:

<script>imageMapResize('[name="faith_boosters_map"]')</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM