다음 jquery 스크립트를 작성했습니다.onMouseOver & onMouseOut 이미지 숨기기 및 표시 - 이미지가 즉시 다시 나타납니다.
<script type="text/javascript">
$(document).ready(function(){
$('#Oval-1').on('mouseover', function(e) {
$("#Oval-1").fadeOut();
});
$('#Oval-1').on('mouseout', function(e) {
$("#Oval-1").fadeIn();
});
});
</script>
타원형 -1은 내 페이지에있는 svg 이미지의 ID입니다. mouseover 나는 이미지를 fadeout, mouseout에서 나는 이미지를 fadein 싶습니다. 그러나 내가 한 것처럼 이미지가 흐려 지지만 즉각적으로 사라져서 한 번 깜박입니다. 내가 여기서 어디로 잘못 가고 있니? 내가 this을 발견했다,하지만 난하지 바닐라 JS 함께, 여기 jQuery로 걱정 :
<div class="wrapper">
<svg width="1024px" height="279px" viewBox="0 0 1024 279" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.6.1 (26313) - http://www.bohemiancoding.com/sketch -->
<title>map png</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="geschichte" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Desktop-Landscape" transform="translate(-145.000000, -332.000000)">
<g id="map" transform="translate(107.000000, 246.000000)">
<g id="mapback" transform="translate(38.000000, 86.000000)">
<g id="map-png">
// there are further paths here, I took out for now
<ellipse id="Oval-1" fill="#0B619B" opacity="0.141849347" cx="929.5" cy="94.5" rx="94.5" ry="94.5"></ellipse>
</g>
</g>
</g>
</g>
</g>
PS :
이는 SVG를 포함하는 내 DIV이다.
여기서 문제는 이미지 GET의 숨겨진, 따라서'mouseout' 해당 의해 트리거됩니다 아마 작동 할 수 있습니다. – empiric