2016-08-19 9 views
1

SVGアニメーションを作成しようとしています。私はポリゴンを作成しました。マウスオーバーすると、テキストが表示され、ポリゴンは自分の形を変えてしまいました。テキストの上にマウスを移動するとポリゴンアニメーションがリセットされます

しかし、このテキストでマウスをホバーすると、ポリゴンアニメーションがリセットされます。 これらのアニメーションを同じままにしておきたい場合は、多角形またはテキスト自体に問題がある可能性があります。それは根本的な形状のホバー状態に干渉しないよう

jQuery(document).ready(function(){ 
 
     jQuery('#poly1').mouseover(function(){ 
 
      var animationToCheck = document.getElementById("animation-to-check"); 
 
      animationToCheck.beginElement(); 
 
     }); 
 
    }); 
 

 
jQuery(document).ready(function(){ 
 
    jQuery('#poly1').mouseout(function(){ 
 
      var animationToChecks = document.getElementById("animation-to-checks"); 
 
      animationToChecks.beginElement(); 
 
     }); 
 
    }); 
 

 

 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly2').mouseover(function(){ 
 
      var animationToCheck = document.getElementById("animation-to-check2"); 
 
      animationToCheck.beginElement(); 
 
     }); 
 
     
 
    }); 
 

 
jQuery(document).ready(function(){ 
 
    jQuery('#poly2').mouseout(function(){ 
 
      var animationToChecks = document.getElementById("animation-to-checks2"); 
 
      animationToChecks.beginElement(); 
 
     }); 
 
    }); 
 

 

 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly3').mouseover(function(){ 
 
      var animationToCheck = document.getElementById("animation-to-check3"); 
 
      animationToCheck.beginElement(); 
 
     }); 
 
     
 
    }); 
 

 
jQuery(document).ready(function(){ 
 
    jQuery('#poly3').mouseout(function(){ 
 
      var animationToChecks = document.getElementById("animation-to-checks3"); 
 
      animationToChecks.beginElement(); 
 
     }); 
 
    }); 
 

 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly4').mouseover(function(){ 
 
      var animationToCheck = document.getElementById("animation-to-check4"); 
 
      animationToCheck.beginElement(); 
 
     }); 
 
     
 
    }); 
 

 
jQuery(document).ready(function(){ 
 
    jQuery('#poly4').mouseout(function(){ 
 
      var animationToChecks = document.getElementById("animation-to-checks4"); 
 
      animationToChecks.beginElement(); 
 
     }); 
 
    }); 
 

 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly1').on('mouseover', function() { 
 
      jQuery('#txt-svg').fadeIn(); 
 
      jQuery('#txt-svg2').fadeIn(); 
 
      jQuery('#txt-svg3').fadeIn(); 
 
     }); 
 
     jQuery('#poly1').on('mouseout', function() { 
 
      jQuery('#txt-svg').fadeOut(); 
 
      jQuery('#txt-svg2').fadeOut(); 
 
      jQuery('#txt-svg3').fadeOut(); 
 
    }); 
 
}); 
 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly2').on('mouseover', function() { 
 
      jQuery('#txt2-svg').fadeIn(); 
 
      jQuery('#txt2-svg2').fadeIn(); 
 
      jQuery('#txt2-svg3').fadeIn(); 
 
     }); 
 
     jQuery('#poly2').on('mouseout', function() { 
 
      jQuery('#txt2-svg').fadeOut(); 
 
      jQuery('#txt2-svg2').fadeOut(); 
 
      jQuery('#txt2-svg3').fadeOut(); 
 
    }); 
 
}); 
 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly3').on('mouseover', function() { 
 
      jQuery('#txt3-svg').fadeIn(); 
 
      jQuery('#txt3-svg2').fadeIn(); 
 
      jQuery('#txt3-svg3').fadeIn(); 
 
     }); 
 
     jQuery('#poly3').on('mouseout', function() { 
 
      jQuery('#txt3-svg').fadeOut(); 
 
      jQuery('#txt3-svg2').fadeOut(); 
 
      jQuery('#txt3-svg3').fadeOut(); 
 
    }); 
 
}); 
 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly4').on('mouseover', function() { 
 
      jQuery('#txt4-svg').fadeIn(); 
 
      jQuery('#txt4-svg2').fadeIn(); 
 
      jQuery('#txt4-svg3').fadeIn(); 
 
     }); 
 
     jQuery('#poly4').on('mouseout', function() { 
 
      jQuery('#txt4-svg').fadeOut(); 
 
      jQuery('#txt4-svg2').fadeOut(); 
 
      jQuery('#txt4-svg3').fadeOut(); 
 
    }); 
 
});
#txt-svg , #txt-svg2 , #txt-svg3 , #txt2-svg , #txt2-svg2 , #txt2-svg3 , #txt3-svg , #txt3-svg2 , #txt3-svg3 , #txt4-svg , #txt4-svg2 , #txt4-svg3 { 
 
    display: none; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" 
 
\t width="100%" height="auto" viewBox="0 0 1360 720" enable-background="new 0 0 1360 720" xml:space="preserve"> 
 

 

 

 
    <a href="index.php/coaching" class="animsition-link"> 
 
    <polygon id="poly3" fill="red" points="1072.229,720.052 572.229,720.052 788.229,0.052 1288.229,0.052 "> 
 
    <animate id="animation-to-check3" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="1072.229,720.052 372.229,720.052 588.229,0.052 1288.229,0.052"/> 
 
    <animate id="animation-to-yellow3" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#FFD41D"/> 
 
    <animate id="animation-to-checks3" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="1072.229,720.052 572.229,720.052 788.229,0.052 1288.229,0.052"/> 
 
    <animate id="animation-to-def3" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#0D3E49"/> 
 
</polygon> 
 
    <text id="txt3-svg" transform="matrix(1 0 0 1 838.6489 280.5)" fill="#1C1B1C" font-family="'Open Sans'" font-size="23">COACHING CENTRES</text> 
 
<text id="txt3-svg2" transform="matrix(1 0 0 1 877.5 323.5)" fill="#1C1B1C" font-family="'zaioregular'" font-size="30">NEAR YOU</text> 
 
<rect id="txt3-svg3" x="890.274" y="339.833" opacity="0.7" fill="#1C1B1C" enable-background="new " width="114.667" height="4"/> 
 
    </a> 
 
    
 
    <a href="index.php/online" class="animsition-link"> 
 
    <polygon id="poly4" fill="green" points="1571.229,720.104 1071.229,720.104 1287.229,0.104 1787.229,0.104 "> 
 
<animate id="animation-to-check4" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="1571.229,720.104 771.229,720.104 987.229,0.104 1787.229,0.104"/> 
 
    <animate id="animation-to-yellow4" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#b30059"/> 
 
    <animate id="animation-to-checks4" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="1571.229,720.104 1071.229,720.104 1287.229,0.104 1787.229,0.104"/> 
 
    <animate id="animation-to-def4" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#54A2AF"/> 
 
    </polygon> 
 
    <text id="txt4-svg" transform="matrix(1 0 0 1 1083.6489 280.5)" fill="#1C1B1C" font-family="'Open Sans'" font-size="23">ONLINE</text> 
 
<text id="txt4-svg2" transform="matrix(1 0 0 1 1075.5 323.5)" fill="#1C1B1C" font-family="'zaioregular'" font-size="30">TUTION</text> 
 
<rect id="txt4-svg3" x="1091.274" y="339.833" opacity="0.7" fill="#1C1B1C" enable-background="new " width="72.667" height="4"/> 
 
    </a> 
 
    
 
    <a href="index.php/locality" class="animsition-link"> 
 
    <polygon id="poly2" fill="yellow" points="572.271,720 72.271,720 288.271,0 788.271,0"> 
 
<animate id="animation-to-check2" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="772.271,720 72.271,720 288.271,0 988.271,0"/> 
 
    <animate id="animation-to-yellow2" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#FFD41D"/> 
 
    <animate id="animation-to-checks2" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="572.271,720 72.271,720 288.271,0 788.271,0"/> 
 
    <animate id="animation-to-def2" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#6599A5"/> 
 
</polygon> 
 
    <text id="txt2-svg" transform="matrix(1 0 0 1 412.6489 280.5)" fill="#1C1B1C" font-family="'Open Sans'" font-size="23">TUTORS IN</text> 
 
<text id="txt2-svg2" transform="matrix(1 0 0 1 362.5 323.5)" fill="#1C1B1C" font-family="'zaioregular'" font-size="30">YOUR LOCALITY</text> 
 
<rect id="txt2-svg3" x="388.274" y="339.833" opacity="0.7" fill="#1C1B1C" enable-background="new " width="164.667" height="4"/> 
 
    </a> 
 
    <a href="index.php/abt" class="animsition-link" id="an-1"> 
 
    
 
    
 
    
 
    <polygon id="poly1" fill="blue" points="72.771,720 -427.229,720 -211.229,0 288.771,0"> 
 
    
 
    <animate id="animation-to-check" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="372.771,720 -427.229,720 -211.229,0 588.771,0"/> 
 
    
 
    <animate id="animation-to-checks" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="72.771,720 -427.229,720 -211.229,0 288.771,0"/> 
 
    <animate id="animation-to-def" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="rgba(190, 242, 247,0.5)"/> 
 
</polygon> 
 
    <text id="txt-svg" transform="matrix(1 0 0 1 82.7598 280.5)" fill="#1C1B1C" font-family="'Open Sans'" font-size="23">TUTOR AT</text> 
 
<text id="txt-svg2" transform="matrix(1 0 0 1 24.6108 323.5)" fill="#1C1B1C" font-family="'zaioregular'" font-size="30">YOUR LOCATION</text> 
 
<rect id="txt-svg3" x="51.385" y="339.833" opacity="0.7" fill="#1C1B1C" enable-background="new " width="164.667" height="4"/> 
 

 
    </a> 
 
</svg>

答えて

0

は、テキスト・ポインタ・イベント=「none」を作成していない:

は、ここに私のコードです。

jQuery(document).ready(function(){ 
 
     jQuery('#poly1').mouseover(function(){ 
 
      var animationToCheck = document.getElementById("animation-to-check"); 
 
      animationToCheck.beginElement(); 
 
     }); 
 
    }); 
 

 
jQuery(document).ready(function(){ 
 
    jQuery('#poly1').mouseout(function(){ 
 
      var animationToChecks = document.getElementById("animation-to-checks"); 
 
      animationToChecks.beginElement(); 
 
     }); 
 
    }); 
 

 

 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly2').mouseover(function(){ 
 
      var animationToCheck = document.getElementById("animation-to-check2"); 
 
      animationToCheck.beginElement(); 
 
     }); 
 
     
 
    }); 
 

 
jQuery(document).ready(function(){ 
 
    jQuery('#poly2').mouseout(function(){ 
 
      var animationToChecks = document.getElementById("animation-to-checks2"); 
 
      animationToChecks.beginElement(); 
 
     }); 
 
    }); 
 

 

 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly3').mouseover(function(){ 
 
      var animationToCheck = document.getElementById("animation-to-check3"); 
 
      animationToCheck.beginElement(); 
 
     }); 
 
     
 
    }); 
 

 
jQuery(document).ready(function(){ 
 
    jQuery('#poly3').mouseout(function(){ 
 
      var animationToChecks = document.getElementById("animation-to-checks3"); 
 
      animationToChecks.beginElement(); 
 
     }); 
 
    }); 
 

 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly4').mouseover(function(){ 
 
      var animationToCheck = document.getElementById("animation-to-check4"); 
 
      animationToCheck.beginElement(); 
 
     }); 
 
     
 
    }); 
 

 
jQuery(document).ready(function(){ 
 
    jQuery('#poly4').mouseout(function(){ 
 
      var animationToChecks = document.getElementById("animation-to-checks4"); 
 
      animationToChecks.beginElement(); 
 
     }); 
 
    }); 
 

 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly1').on('mouseover', function() { 
 
      jQuery('#txt-svg').fadeIn(); 
 
      jQuery('#txt-svg2').fadeIn(); 
 
      jQuery('#txt-svg3').fadeIn(); 
 
     }); 
 
     jQuery('#poly1').on('mouseout', function() { 
 
      jQuery('#txt-svg').fadeOut(); 
 
      jQuery('#txt-svg2').fadeOut(); 
 
      jQuery('#txt-svg3').fadeOut(); 
 
    }); 
 
}); 
 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly2').on('mouseover', function() { 
 
      jQuery('#txt2-svg').fadeIn(); 
 
      jQuery('#txt2-svg2').fadeIn(); 
 
      jQuery('#txt2-svg3').fadeIn(); 
 
     }); 
 
     jQuery('#poly2').on('mouseout', function() { 
 
      jQuery('#txt2-svg').fadeOut(); 
 
      jQuery('#txt2-svg2').fadeOut(); 
 
      jQuery('#txt2-svg3').fadeOut(); 
 
    }); 
 
}); 
 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly3').on('mouseover', function() { 
 
      jQuery('#txt3-svg').fadeIn(); 
 
      jQuery('#txt3-svg2').fadeIn(); 
 
      jQuery('#txt3-svg3').fadeIn(); 
 
     }); 
 
     jQuery('#poly3').on('mouseout', function() { 
 
      jQuery('#txt3-svg').fadeOut(); 
 
      jQuery('#txt3-svg2').fadeOut(); 
 
      jQuery('#txt3-svg3').fadeOut(); 
 
    }); 
 
}); 
 

 
jQuery(document).ready(function(){ 
 
     jQuery('#poly4').on('mouseover', function() { 
 
      jQuery('#txt4-svg').fadeIn(); 
 
      jQuery('#txt4-svg2').fadeIn(); 
 
      jQuery('#txt4-svg3').fadeIn(); 
 
     }); 
 
     jQuery('#poly4').on('mouseout', function() { 
 
      jQuery('#txt4-svg').fadeOut(); 
 
      jQuery('#txt4-svg2').fadeOut(); 
 
      jQuery('#txt4-svg3').fadeOut(); 
 
    }); 
 
});
#txt-svg , #txt-svg2 , #txt-svg3 , #txt2-svg , #txt2-svg2 , #txt2-svg3 , #txt3-svg , #txt3-svg2 , #txt3-svg3 , #txt4-svg , #txt4-svg2 , #txt4-svg3 { 
 
    display: none; 
 
} 
 

 
text { 
 
    pointer-events: none; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" 
 
\t width="100%" height="auto" viewBox="0 0 1360 720" enable-background="new 0 0 1360 720" xml:space="preserve"> 
 

 
    <a href="index.php/coaching" class="animsition-link"> 
 
    <polygon id="poly3" fill="red" points="1072.229,720.052 572.229,720.052 788.229,0.052 1288.229,0.052 "> 
 
    <animate id="animation-to-check3" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="1072.229,720.052 372.229,720.052 588.229,0.052 1288.229,0.052"/> 
 
    <animate id="animation-to-yellow3" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#FFD41D"/> 
 
    <animate id="animation-to-checks3" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="1072.229,720.052 572.229,720.052 788.229,0.052 1288.229,0.052"/> 
 
    <animate id="animation-to-def3" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#0D3E49"/> 
 
</polygon> 
 
    <text id="txt3-svg" transform="matrix(1 0 0 1 838.6489 280.5)" fill="#1C1B1C" font-family="'Open Sans'" font-size="23">COACHING CENTRES</text> 
 
<text id="txt3-svg2" transform="matrix(1 0 0 1 877.5 323.5)" fill="#1C1B1C" font-family="'zaioregular'" font-size="30">NEAR YOU</text> 
 
<rect id="txt3-svg3" x="890.274" y="339.833" opacity="0.7" fill="#1C1B1C" enable-background="new " width="114.667" height="4"/> 
 
    </a> 
 
    
 
    <a href="index.php/online" class="animsition-link"> 
 
    <polygon id="poly4" fill="green" points="1571.229,720.104 1071.229,720.104 1287.229,0.104 1787.229,0.104 "> 
 
<animate id="animation-to-check4" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="1571.229,720.104 771.229,720.104 987.229,0.104 1787.229,0.104"/> 
 
    <animate id="animation-to-yellow4" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#b30059"/> 
 
    <animate id="animation-to-checks4" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="1571.229,720.104 1071.229,720.104 1287.229,0.104 1787.229,0.104"/> 
 
    <animate id="animation-to-def4" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#54A2AF"/> 
 
    </polygon> 
 
    <text id="txt4-svg" transform="matrix(1 0 0 1 1083.6489 280.5)" fill="#1C1B1C" font-family="'Open Sans'" font-size="23">ONLINE</text> 
 
<text id="txt4-svg2" transform="matrix(1 0 0 1 1075.5 323.5)" fill="#1C1B1C" font-family="'zaioregular'" font-size="30">TUTION</text> 
 
<rect id="txt4-svg3" x="1091.274" y="339.833" opacity="0.7" fill="#1C1B1C" enable-background="new " width="72.667" height="4"/> 
 
    </a> 
 
    
 
    <a href="index.php/locality" class="animsition-link"> 
 
    <polygon id="poly2" fill="yellow" points="572.271,720 72.271,720 288.271,0 788.271,0"> 
 
<animate id="animation-to-check2" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="772.271,720 72.271,720 288.271,0 988.271,0"/> 
 
    <animate id="animation-to-yellow2" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#FFD41D"/> 
 
    <animate id="animation-to-checks2" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="572.271,720 72.271,720 288.271,0 788.271,0"/> 
 
    <animate id="animation-to-def2" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="#6599A5"/> 
 
</polygon> 
 
    <text id="txt2-svg" transform="matrix(1 0 0 1 412.6489 280.5)" fill="#1C1B1C" font-family="'Open Sans'" font-size="23">TUTORS IN</text> 
 
<text id="txt2-svg2" transform="matrix(1 0 0 1 362.5 323.5)" fill="#1C1B1C" font-family="'zaioregular'" font-size="30">YOUR LOCALITY</text> 
 
<rect id="txt2-svg3" x="388.274" y="339.833" opacity="0.7" fill="#1C1B1C" enable-background="new " width="164.667" height="4"/> 
 
    </a> 
 
    <a href="index.php/abt" class="animsition-link" id="an-1"> 
 
    
 
    
 
    
 
    <polygon id="poly1" fill="blue" points="72.771,720 -427.229,720 -211.229,0 288.771,0"> 
 
    
 
    <animate id="animation-to-check" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="372.771,720 -427.229,720 -211.229,0 588.771,0"/> 
 
    
 
    <animate id="animation-to-checks" begin="indefinite" fill="freeze" attributeName="points" dur="500ms" to="72.771,720 -427.229,720 -211.229,0 288.771,0"/> 
 
    <animate id="animation-to-def" begin="indefinite" fill="freeze" attributeName="fill" dur="500ms" to="rgba(190, 242, 247,0.5)"/> 
 
</polygon> 
 
    <text id="txt-svg" transform="matrix(1 0 0 1 82.7598 280.5)" fill="#1C1B1C" font-family="'Open Sans'" font-size="23">TUTOR AT</text> 
 
<text id="txt-svg2" transform="matrix(1 0 0 1 24.6108 323.5)" fill="#1C1B1C" font-family="'zaioregular'" font-size="30">YOUR LOCATION</text> 
 
<rect id="txt-svg3" x="51.385" y="339.833" opacity="0.7" fill="#1C1B1C" enable-background="new " width="164.667" height="4"/> 
 

 
    </a> 
 
</svg>

+0

感謝の先生、私のためにその作業罰金。 – user2980415

関連する問題