我需要一些帮助,这个jQuery代码。我有一个SVG地图,我需要一个点击一个国家来选择一个国家,并取消选择另一个。有人能帮助我吗? :) 这是代码:jquery点击功能选择并取消选择
<script type="text/javascript">//<![CDATA[
$(window).load(function(){
$(document).ready(function() {
$("path").mouseover(function() {
$(this).css('cursor', 'pointer');$(this).attr({
fill: "#FF0000",
stroke: "#00FF00"
});
$(this).css('cursor', 'pointer');
})
.mouseout(function(){
if(!$(this).data('clicked')){
$(this).attr({
fill: "#FFFFFF",
stroke: "#eee"
});
}
});
$("path").click(function() {
$(this).attr({
fill: "#FF0000",
stroke: "#00FF00"
});
$(this).data('clicked', true);
});
});
});//]]>
</script>
时加入一些类你不解释你得到的是什么问题或错误,这是一个很糟糕的问题,只是粘贴代码。 – Nelson