以下のJSFiddleコードを見つけましたが、正確なコピーを実行してhtmlドキュメントに貼り付けると、機能しません。Chromeを使用しています。Javascriptコンソールに構文エラーがあると表示されますが、何も表示されません。なぜこれが機能しないのかわかりません。
JSFiddle(作業中)
動作しないコピーアンドペースト(Divにカーソルを合わせるとアラートが起動しません)
<!DOCTYPE html>
<meta charset="UTF-8">
<title>fun</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<a id="animationTest">Hover over me</a>
<!--CSS-->
<style>
#animationTest {
width: 150px;
text-align: center;
display: block;
padding: 20px;
background: #000;
color: #fff;
border-bottom: 10px solid red;
cursor: pointer;
transition: border-bottom 0.5s linear; /* vendorless fallback */
-o-transition: border-bottom 0.5s linear; /* opera */
-ms-transition: border-bottom 0.5s linear; /* IE 10 */
-moz-transition: border-bottom 0.5s linear; /* Firefox */
-webkit-transition: border-bottom 0.5s linear; /*safari and chrome */
}
#animationTest:hover {
border-bottom: 10px solid blue;
}
</style>
<!--Javascript -->
<script>
var animationTest = document.getElementById('animationTest');
animationTest.addEventListener('webkitTransitionEnd', function(){
alert("Finished animation (listener)!");
console.log("Finished animation (listener)!");
});
$('#animationTest').bind("webkitTransitionEnd", function(){
alert("Finished animation (bind)!");
console.log("Finished animation (bind)!");
});
</script>