基本的に、クリックするとさらにテキストが表示されるこのJSスクリプトがあります。問題は、これが配置されている div が、すべてのテキストがそこにある場合と同じ大きさのままであることです。div がテキストのプレビューと同じ大きさであることを望みます。その後、+ ボタンをクリックすると、div はすべてのテキストと同じ大きさに拡張されます。
展開されていない場合は次のとおりです: http://puu.sh/FZj6 展開されている場合 : http://puu.sh/FZjD
ご覧のとおり、div サイズはずっと同じままです。
JS
function hx(elmnt){document.getElementById(elmnt).style.visibility="hidden";}
function sx(elmnt){document.getElementById(elmnt).style.visibility="visible";}
HTML
This is the text that is automatically there. When you click the + to the left, the rest of the text appears. (<a onClick="sx('more')" style="cursor:pointer;" title="Show more">+</a>)
<div id="more" style="visibility:hidden;">
<p>(<a onClick="hx('more')" style="cursor:pointer;" title="Show less">-</a>)<br /><br>
This is the text that appears when the + is clicked. The - above removes this text. When the minus is clicked, the div should restore to original size.
どんな助けでも大歓迎です!ありがとう。