Raphael 对热区的控制

JS插件的下载和教学地址raphaeljs

  $(function () {
            var R = Raphael(0, 0, 1440, 1360);
            x = document.getElementsByTagName('area');
       for (j = 0; j < x.length; j++) { (function (s) { var c = R.path(s); c.attr({ "fill": "#fff", "fill-opacity": 0, "stroke-width": 0 }); c.mouseover(function () { c.animate({ "fill-opacity": .50, 'fill': "#fff", "stroke-width": 3, "stroke": "yellow" }, 500); }).mouseout(function () { c.animate({ "fill-opacity": 0, "stroke-width": 0 }, 500); }); })(AreaFoucs(x[j].coords)); } }); function AreaFoucs(str) { var arry = str.split(','); var str = "M"; for (i = 0; i < arry.length; i++) { str += arry[i]; if (i % 2 == 0) { str += ","; } else { str += "L"; } } str += arry[0] + "," + arry[1]; return str; }
原文地址:https://www.cnblogs.com/akingyao/p/2766249.html