jQueryには20個の関数があり、divを上下にスライドさせて配置します。
私の質問は:
名前付き関数を使用するようにこのコードを変更するにはどうすればよいですか。名前を付けてコードを 1 つの関数にまとめることはできますか?
$('#top1').click(function() {
$('#book3').slideDown('slow', function() {
// Animation complete.
});
});
$('#luk3').click(function() {
$('#book3').slideUp('slow', function() {
// Animation complete.
});
});
$('#top2').click(function() {
$('#book4').slideDown('slow', function() {
// Animation complete.
});
});
$('#luk4').click(function() {
$('#book4').slideUp('slow', function() {
// Animation complete.
});
});
私はまだ多くの機能を持っていますが、それらすべてを書くつもりはありません。
<div id="top3">
Opdater Password til absb.dk
</div>
<div id="book5">
<h5>Updater adgangskode</h5>
<form action="#" method="post">
<table>
<tr>
<td>Adgangskode</td>
<td><input type="password" name="pass" class="new"></td>
</tr>
<tr>
<td>Adgangskode gentag</td>
<td><input type="password" name="gentag" class="new"></td>
</tr>
<tr>
<td><input type="submit" name="opdater_pass" value="Opdater" class="new upload_boxxen"></td>
<td></td>
</tr>
</table>
<?php
if(isset($_POST["opdater_pass"]))
{
$updater_pass = $mebe->updater_pass();
}
?>
</form>
<div id="luk5">
Luk
</div>
</div>
これは私のコンテンツの一部です