我在我的網站中有一個時間線功能,在某一年文本可能非常長,有些可能只有1行,我想調整頁面大小,以便當用戶在下一年點擊該頁面並非真的很長,只有一行?如何在jQuery中調整ul,div p
IM使用timeliner JS從 http://www.csslab.cl/ejemplos/timelinr/latest/js/jquery.timelinr-0.9.5.js
<ul id="dates">
<li><a href="#1940s">1940s</a></li>
<li><a href="#1950s">1950s</a></li>
</ul>
<ul id="issues">
<li id="1940s"><img src="/timeline/1950.jpg" />
<h1>1940's</h1>
<p>RonaldertreRonaldertreRonaldertrevRonaldertre Ronaldertre RonaldertreRonaldertre Ronaldertre Ronaldertre Ronaldertre Ronaldertre Ronaldertre Ronaldertre Ronaldertre vkv RonaldertreRonaldertre kRonaldertre Ronaldertre Ronaldertre Ronaldertre Ronaldertrekv Ronaldertre RonaldertreRonaldertre Ronald “Eddy” Edmonson a qualified architect and surveyor joined the Royal Artillery in WW2. At the end of vre RonaldertreRonaldertre Ronald “Eddy&rdquoWar he found himself stationed in Turin, and became interested in a nearby factory where the Germans held early experiments in plastic injection moulding. After being re RonaldertreRonaldertre Ronald “Eddy” Edmonson a qualified architect and surveyor joined the Royal Artillery in WW2. At the end of the War he found himself stationed in Turin, and became interested in a nearby factory where the Germans held early experiments in plastic injection moulding. After being re RonaldertreRonaldertre Ronald “Eddy” Edmonson a qualified architect and surveyor joined the Royal Artillery in WW2. At the end of the War he found himself stationed in Turin, and became interested in a nearby factory where the Germans held early experiments in plastic injection moulding. After being the War he found himself stationed in Turin, and became interested in a nearby factory where the Germans held early experiments in plastic injection moulding. After being Demobbed back at home, Eddy took this interest further and on 18th October 1946 set up plastic moulding company, Plastiers Limited (Lewisham). He is pictured (right) manning his first commercial production run! RonaldertreRonaldertreRonaldertreRonaldertreRonaldertrevRonaldertreRonaldertre test test test.</p>
</li>
<li id="1950s"><img src="/timeline/1960.jpg" />
<h1>1950's</h1>
<p>Eddy.</p>
</li>
</li>
</ul>
實施例這裏:
http://jsfiddle.net/uzi002/sEFQS/1/
編輯:
jquery的IVE嘗試:
$("#dates li a").click(function() {
$('#issues').css("height", $("#" + $(this).html()).height());
});
武漢理工大學,這個問題確實是模糊的... – Phil 2012-03-23 14:32:58
我如何調整頁面的高度作爲文本的變化當你沿着時間軸 – Beginner 2012-03-23 14:36:30