2014-07-07 3 views
3

링크로 일부 타원이있는 SVG가있는 레일 앱이 있습니다. 링크는 정상적으로 작동하지만 Turbolinks에서는 작동하지 않습니다. 정상 링크는 터보 링크와 잘 작동합니다. SVG 링크를 Turbolinks와 함께 사용할 수있는 방법이 있습니까?터보 링크가 SVG 링크로 작동하지 않습니다.

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" 
     height="650px" viewBox="0 0 341.334 532.666" enable-background="new 0 0 341.334 532.666" 
    xml:space="preserve" id="map"> 
<g id="Layer_2"> 
    <a xlink:href="/lotes/84" data-toggle="tooltip" title="Lote 84"> 
     <ellipse fill="none" id="L-84" stroke="#000000" stroke-miterlimit="10" cx="27.833" cy="135.997" rx="23.833" ry="24.333" class="lote "/> 
    </a> 
    <a xlink:href="/lotes/090" data-toggle="tooltip" title="Lote 090"> 
     <ellipse fill="none" id="L-090" stroke="#000000" stroke-miterlimit="10" cx="74.667" cy="185.831" rx="23" ry="24.167" class="lote Algodon"/> 
    </a> 
    <a xlink:href="/lotes/091" data-toggle="tooltip" title="Lote 091"> 
     <ellipse fill="none" id="L-091" stroke="#000000" stroke-miterlimit="10" cx="122.833" cy="187.331" rx="23.833" ry="24" class="lote Algodon"/> 
    </a> 
</g> 
</svg> 

답변

0

이 경우 단지 opened an issue입니다. 그동안 Turbolinks 3 (2는 확실하지 않음)을 사용하면 Turbolinks.visit()으로 해결 방법을 관리 할 수 ​​있습니다. jQuery로

: D3와

$('svg a').on('click', function(event) { 
    event.preventDefault(); 
    Turbolinks.visit(this.getAttribute('href')); 
}); 

:

svg.selectAll('a') 
    .on('click', function() { 
    d3.event.preventDefault(); 
    Turbolinks.visit( 
     d3.select(this).node().getAttribute('href') 
    ); 
    }); 
관련 문제