[
[返信する]]
【解決】開閉ボタンについて
by 匿名
2016-04-09 08:24
開閉ボタンがどうしても段落の大きさになってしまうのですが、文字(ボタン)の部分のみにするやり方はあるでしょうか?
@の方がボタンが段落になってしまう為、Aの方を試してみたらボタンが微妙に跳ねるようになりどちらも希望通りに設定できません。@のボタンが段落にならないか、Aのボタンが跳ねないようにする方法はあるでしょうか。分かる方がおりましたら宜しくお願いします。
@
<style type="text/css">
<!--
p.switching {
cursor: pointer;
}
p.switching:hover {
text-decoration: underline;
}
p.comment {
display: none;
}
-->
</style>
<script type="text/javascript" src="url"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
$("p.switching").on("click", function() {
$(this).next().slideToggle(180);
});
});
//-->
</script>
<p class="switching">ボタン</p><p class="comment">コメント</p>
A
<style type="text/css">
<!--
span.switching {
cursor: pointer;
}
span.switching:hover {
text-decoration: underline;
}
span.comment {
display: none;
}
-->
</style>
<script type="text/javascript" src="url"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
$("span.switching").on("click", function() {
$(this).next().slideToggle(180);
});
});
//-->
</script>
<span class="switching">ボタン</span><span class="comment">コメント</span>
-----
インラインブロックにしたら段落になっていたボタンのサイズを上手く調整出来ました。
自分ではどうしても思うように出来なかったので助かりました、的確なアドバイスを頂き本当に有難うございました。
pc
[編集]
by 匿名
2016-04-09 10:53
p.switchingに対し幅を指定するかインライン要素またはインラインブロックにしてはいかがでしょうか。
pはブロック要素ですから何も指定しなければ幅いっぱいになります。
JavaScriptの方は分からないため見てませんので見当違いでしたらすみません。
pc
[編集]
[
返信する]
[
戻る
]