<script type="text/javascript">
var button = document.getElementById("button");
var idTab5 = document.getElementById("idTab5");
var button2 = document.getElementById("button2");
function showwMore() {
button.style.display="none";
idTab5.style="overflow:hidden;display:block;height:100%;font-size:12px;line-height:14px;";
button2.style.display="block";
}
function showwLess() {
button2.style.display="none";
idTab5.style="overflow:hidden;height:250px;font-size:12px;line-height:14px;";
button.style.display="block";
}
</script>
,這是其他代碼:的Javascript:上按鈕改變股利大小單擊
{if $product->description|count_characters:true > 350 }
{* full description *}
<div id="idTab5" style="overflow:hidden;height:250px;font-size:12px;line-height:14px;">{$product->description}</div>
<input id="button" type="button" style="margin-top:5px;font-size:12px;color:white; width:120px;background:#4e3248;border:none;height:30px;border-radius:5px;" value="Mostrar +" onclick="showwMore()">
<input id="button2" type="button" style="margin-top:5px;display:none;font-size:12px;color:white; width:120px;background:#4e3248;border:none;height:30px;border-radius:5px;" value="Mostrar -" onclick="showwLess()">
{else}
<div id="idTab5" style="overflow:hidden;height:250px;font-size:12px;line-height:14px;">{$product->description}</div>
{/if}
現在它似乎沒什麼問題,但的onclick,股利心不是越來越大,任何想法,爲什麼會出現這種情況?香港專業教育學院多次檢查代碼無法找出爲什麼它不工作,我錯過了什麼?
你一定是在跟我開玩笑,在開始我的代碼正在工作,突然它停止工作..現在改變剛纔你建議再工作...... jeez,非常感謝。 – user1738483
你有什麼想法如何實現一個小小的CSS動畫,因此該div不會變得更快? – user1738483
它http://stackoverflow.com/questions/15768242/trying-to-use-basic-javascript-to-animate-a-div-and-make-it-bigger-but-have-it-g給出了一些上下文給你。 –