2016-09-30 61 views

回答

0

$(document).ready(function() { 
 
    
 
     var flag = true; // take a flag here 
 
    
 
     $(".S1").mouseover(function() { 
 
      if (flag) { // check flag before change 
 
       $(".S1").css('fill', '158844'); 
 
       $(".S1").css('stroke', '158844'); 
 
      } 
 
     }); 
 
    
 
     $(".S1").mouseout(function() { 
 
      if (flag) { // check flag before change 
 
       $(".S1").css('fill', '#000000'); 
 
       $(".S1").css('stroke', '#000000'); 
 
      } 
 
     }); 
 
    
 
     $(".S1").click(function() { 
 
      flag = false; // reset flag 
 
      $(".S1").css('fill', '158844'); 
 
      $(".S1").css('stroke', '158844'); 
 
     }); 
 
    
 
});
<svg> 
 
<line class = "S1" fill="none" stroke="#000000" stroke-width="3.8417" x1="73.208" y1="73.341" x2="99.923" y2="73.341"/> 
 
<polygon class = "S1" 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>

相关问题