请帮忙-一定有更好的办法!所以基本上,在svg中,我有一堆类名为1-50的元素,然后是一堆id为1-50的对应元素。
$(document).ready(function(){
if ($('.1').hasClass('hotspot-active') ) {
$('#1').addClass('locator-active');
}
});
$(document).ready(function(){
if ($('.2').hasClass('hotspot-active') ) {
$('#2').addClass('locator-active');
}
});
$(document).ready(function(){
if ($('.3').hasClass('hotspot-active') ) {
$('#3').addClass('locator-active');
}
});
HTML看起来像这样-
<circle class="1" cx="1078.34" cy="656.84" r="12.75"/>
<circle class="2" cx="1547.13" cy="613.3" r="12.75"/>
<circle class="3 hotspot-active" cx="1578.15" cy="221.17" r="12.75"/>
<path id="1" />
<path id="2" />
<path id="3" />