javascript - 单击图像映射并在 Bootstrap 中打开模式窗口

标签 javascript twitter-bootstrap-3 bootstrap-modal imagemap

下午好。我有一个图像 map ,需要打开一个点击图像的模式。 然而,我今天发现我不能使用标签来图像映射...... 我想知道如何使用图像 map 打开模式

它不是这样工作的:

<a href="<c:url value="/myApp/test"/>" data-toggle="modal" data-target="#new-modal"><area shape="rect" coords="289,399,368,662 ></a>

要运行 map ,必须没有标签“a href”,如下所示......

<area shape="rect" coords="289,399,368,662" href="<c:url value="/myApp/test"/>" data-toggle="modal" data-target="#new-modal">

只有这样才不会开启模态bootstrapping。

最佳答案

我遇到了同样的问题并遇到了这个解决方案。 我们应该从区域中删除 href 并包含 data-toggle="modal"和 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">&times;</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>

关于javascript - 单击图像映射并在 Bootstrap 中打开模式窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38754467/

相关文章:

javascript - 如何使用 webpack (sourcemap) 获得更具可读性的 bundle.js?

javascript - 即使从数据列表中选择选项也会触发响应式(Reactive)表单的 valueChanges 事件

html - 为什么我的网页不遵守最大宽度和最小宽度规则?

twitter-bootstrap - Bootstrap 3 中响应式导航栏的问题

jquery - FullCalendar 外部事件丢弃两种不同的模式

css - 使用 angularjs 的 Bootstrap 模式在 plunker 或 jsfiddle 中工作,但在本地不起作用

javascript - 优雅地将方法重新附加到 Web Worker 中的对象?

javascript - p5.j​​s 访问各个像素值

html - <p> jumbotron 内的 Bootstrap 内联按钮下拉菜单

css - 在设计我的 Rails 选择菜单时遇到问题