0
我試圖用jQuery單擊事件處理程序更改SVG對象的顏色,但點擊後顏色恢復正常。點擊更改SVG填充覆蓋 - jQuery
在這裏看到:http://jsfiddle.net/6wwUm/
我怎樣才能永久地改變顏色?
<svg>
<line class = "A1" fill="none" stroke="#000000" stroke-width="3.8417" x1="73.208" y1="73.341" x2="99.923" y2="73.341"/>
<polygon class = "A1" points="97.23,82.618 97.176,72.229 97.121,61.843 106.145,66.987 115.169,72.136 106.2,77.377 "/>
</svg>
<script>
$(document).ready(function() {
$(".A1").mouseover(function(){
$(".A1").css('fill', '158844');
$(".A1").css('stroke', '158844');
});
$(".A1").mouseout(function(){
$(".A1").css('fill', '#000000');
$(".A1").css('stroke', '#000000');
});
$(".A1").click(function(){
$(".A1").css('fill', '158844');
$(".A1").css('stroke', '158844');
$("#appearOnAcross").show();
$("#appearOnDown").hide();
alert('jQuery Alert')
});
});
</script>
完美的作品 - 謝謝! – user2512696