Good afternoon. I have an image map and need to open a modal clicking on the image. However, I found out today that I can not use the tags to image map ... I wonder how can I open a modal using image-map
It does not work like this:
<a href="<c:url value="/myApp/test"/>" data-toggle="modal" data-target="#new-modal"><area shape="rect" coords="289,399,368,662 ></a>
To run the map would have to be without the tags "a href" as below ...
<area shape="rect" coords="289,399,368,662" href="<c:url value="/myApp/test"/>" data-toggle="modal" data-target="#new-modal">
only in this way does not open modal bootstrapping.
I had the same issue and encounter this solution. We should remove the href from area and include the data-toggle="modal" and data-target="#id"
<img src="desktop.jpg usemap="#May2May16-1">
<map name="May2May16-1" class="default">
<area shape="rect" coords="691,336,1239,375" style="outline:none" title="Offer Details" alt="Offer Details" data-toggle="modal" data-target="#myModal">
</map>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.