作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经使用 AngularJS 设置了一个单页 Web 应用程序,在我的一个部分中,我有一个图像映射,并想在鼠标悬停时突出显示这些区域。我试着四处寻找,试图弄清楚如何做到这一点,但我不确定出了什么问题。这是代码。
我尝试使用 https://github.com/cowglow/AngularJS-maphilights作为资源
<section class="artistinfo">
<div class="artist cf">
<h1>Select a room for more details</h1>
<div class="info">
<img ng-src="images/housediagram.jpg" alt="Photo of thing" class="map" usemap="#houseMap">
<map name="houseMap" id="Map" class="maphilight">
<area name="kitchen" shape="poly" coords="197,193,348,194,349,301,197,302" href="#/kitchen"/>
<area name="livingroom" shape="poly" coords="349,194,349,300,562,301,561,192" href="#/livingroom"/>
<area name="laundry" shape="poly" coords="389,309,390,399,562,399,563,308" href="#/laundry"/>
<area name="basement" shape="poly" coords="387,309,388,399,197,399,197,306" href="#/basement"/>
<area name="office" shape="poly" coords="198,108,196,190,301,191,301,83,256,80" href="#/office"/>
<area name="bathroom" shape="poly" coords="301,83,302,190,418,191,417,83" href="#/bathroom"/>
<area name="bedroom" shape="poly" coords="419,83,417,192,560,191,560,109,494,80" href="#/bedroom"/>
</map>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script>
<script type="text/javascript" src="angular-maphilights.js"></script>
<script type="text/javascript" charset="utf-8">
angular.module('map', ['maphilights']);
</script>
</div>
最佳答案
您必须编辑他的代码,因为他实际上并没有调用执行突出显示的 jQuery 函数。您可以将链接功能替换为以下内容
link: function (scope, element, attr) {
$(element).load(function () {
$(element).maphilight();
}).trigger('load');
}
此外,请务必在 <img>
上应用您的指令标签,而不是 <map>
标签。
关于javascript - 如何使用 AngularJS 在部分 html 文件中悬停时突出显示图像图中的区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30987682/
有没有一种方法可以“标记”对象的属性,使它们在反射中“突出”? 例如: class A { int aa, b; string s1, s2; public int AA
我是一名优秀的程序员,十分优秀!