私はjQueryのスピードを上げようとしていますが、私はまだいくつかの基本を見逃していると思います。私は複雑なダイアログポップアップ(下に蒸留されています)を持っています。そしてそれらを1つの「クラス」に統合する方法が分かりません。ダイアログボックスの統合コード
HTML:
<div id="FirstDialogFrame"
title="First"
data-button="Alert First"
data-alert="FirstAlert">
</div>
<div id="SecondDialogFrame"
title="Second"
data-button="Alert First"
data-alert="SecondAlert" >
</div>
<button id="PopFirst">First</button>
<button id="SecondFirst">Second</button>
はJavaScript:
$("#FirstDialogFrame").dialog({
autoOpen: false,
resizable: true,
height: 340,
width: 340,
modal: true,
buttons: {
"Alert": function() {
alert($(this).attr("data-alert"));
$(this).dialog("close");
},
Close: function() {
$(this).dialog("close");
}
}
});
$("#SecondDialogFrame").dialog({
autoOpen: false,
resizable: true,
height: 340,
width: 340,
modal: true,
buttons: {
"Alert": function() {
alert($(this).attr("data-alert"));
$(this).dialog("close");
},
Close: function() {
$(this).dialog("close");
}
}
});
$("#PopFirst").click(function() {
$("#FirstDialogFrame").dialog("open");
});
$("#SecondFirst").click(function() {
$("#SecondDialogFrame").dialog("open");
});
フィドル:すべてのフィードバックは感謝
http://jsfiddle.net/tzerb/BYKqM/
。
TIA。
完璧、最初。どうもありがとう! – tzerb