段階的開示用のこの古いjqueryスクリプトがあります:($(this).text('more ...')コードがボタンのテキストを変更することに注意してください。
<!--for more/less progressive disclosure-->
<script >
$(document).ready(function () {
$('div.view').hide();
$('div.slide').toggle(function () {
this.style.background = '#7D4F4E';
$(this).text('less...').siblings('div.view').fadeIn('fast');
}, function () {
this.style.background = '#B0B07F';
$(this).text('more...').siblings('div.view').fadeOut('fast');
});
});
</script>
それは問題なく動作しますが、私は以下のものを使用したいと思います、そして私はこのjqueryスクリプトに(ボタンのために)同じテキスト変更を持たせたいです。上記のコードのテキスト変更を下部の新しいスクリプトに適用するにはどうすればよいですか?
<!--a real good progressive disclosure-->
<script type="text/javascript">
$(document).ready(function () {
$('.mover').hide();
$('#slideToggle').click(function () {
$(this).siblings('.mover').slideToggle();
});
$('.toggleSlow').click(function () {
$(this).siblings('.mover').toggle('normal');
});
$('#fadeInOut').toggle(function () {
$(this).siblings('.mover').fadeIn('normal');
}, function () {
$(this).siblings('.mover').fadeOut('normal');
});
$('#animate').click(function () {
$(this).siblings('.mover').slideDown(5500).fadeOut(7300);
});
});
</script>