これを長い間解決しようとして、jsfiddle はこのコードを再生成して問題を示すことはありません。
以前は hide() と show('slide') で処理されていた要素で、'click' イベントが 2 回トリガーされます。
show()
or fadeIn(1000)
;を使用する場合は発生しません。内でイベント ハンドラーを移動する場合は発生しません$(document).ready(){}
。
<script></script>
要素の内部でこの正確な構造を使用する必要があります。どうせ変えられない。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link href='/styles/jquery-ui-1.8.18.custom.css' rel='stylesheet' type='text/css'>
<script src='/js/jquery.js' type='text/javascript'></script>
<script src='/js/jquery-ui-1.8.18.custom.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function() {
$('#container').hide().delay(750).show('slide');
});
</script>
</head>
<body>
<div id='container'>
<div class='download'>Download</div>
<script type='text/javascript' id='js4container'>
$('.download').click(function() {
alert('Trigger');
});
</script>
</div>
</body>
</html>
同じイベントをバインドして、内部をもう一度show()
起動することを理解しています。<script></script>
回避策はありますか? =)
助けてください。ありがとう。