2016-03-30 14 views
1

に取り組んでいませんこんにちは、私はいくつかのものに取り組んでいると私は、SVGパスを使用していますが、それは動作していないのはなぜSVGのクリックイベントがClickイベントは、SVGパス

$path.map(function(){ 
    $(this).mouseenter(function(){ 
     $count = $path.attr('data-like'); 
     $('#counter').text($count); 
     $('#tool').addClass('active'); 

    }); 
    $(this).mousemove(function(e){ 
     $('#tool').css({'top': e.pageY + -14,'left': e.pageX + -14}); 
    }); 
    $(this).mouseleave(function(){ 
     $('#tool').removeClass('active'); 
    }); 
    $(this).click(function(){ 
     console.log('click'); 
    }); 


    }); 

を動作していませんか?

編集:私がマウスセンターの機能を間違えたとき、不思議なことに機能を開始します。

+0

最高のあなたが作成した場合、[MCVE] –

答えて

0

てみイベントハンドラで使用する:

$path.map(function(){ 
    $(this).mouseenter(function(){ 
     $count = $path.attr('data-like'); 
     $('#counter').text($count); 
     $('#tool').addClass('active'); 

    }); 
    $(this).mousemove(function(e){ 
     $('#tool').css({'top': e.pageY + -14,'left': e.pageX + -14}); 
    }); 
    $(this).mouseleave(function(){ 
     $('#tool').removeClass('active'); 
    }); 
    $(this).on("click", function(){ 
     console.log('click'); 
    }); 


    }); 
+0

が機能していない、試さ取り組んでいます –

0

私が代わりにクリック機能ののmouseup使用し、それが今