jQuery SVG元素鼠标事件

时间:2016-05-24 11:47:46

标签: javascript jquery html ruby-on-rails svg

过去一小时试图想出这个问题一直在摸不着头脑。

我有以下SVG内联代码,我似乎无法在组甚至多边形元素上触发mouseenter事件。我想念的是什么人?

HTML

<g id="hall1" class="hallBlock">
 <polygon id="Fill-1" fill="#FFFFFF" points="0.508 83.586 83.957 83.586 83.957 0.501 0.508 0.501"></polygon>
 <polygon id="Stroke-2" stroke="#F5F5F5" points="0.508 83.586 83.957 83.586 83.957 0.501 0.508 0.501"></polygon>
  <text id="01" font-family="LucidaGrande, Lucida Grande" font-size="18" font-weight="normal" fill="#D6D6D6">
    <tspan x="32.9956" y="43.7445813">01</tspan>
  </text>
</g>

的jQuery

var $hallBlock = $('.hallBlock');

$hallBlock.mouseenter(function(){
  console.log('mouse enter');
});

0 个答案:

没有答案
相关问题