我剛剛意識到我搞砸了我的最後一個問題。獲取div的高度javascript動態內容加載到它
我使用下面的腳本來獲取DIV#tweet-area的動態高度並將該高度插入到CSS中。
var tweetheight = $("#tweet-area").height();
$("#sidebar-wrapper").css({ bottom: tweetheight});
它的工作方式BEAUT但我才意識到它變得高度,是我的Twitter內容之前的div的高度被加載。我的Twitter內容由jQuery插件生成,請參見下文。
我使用這個jQuery插件,嘰嘰喳喳 - tweet.seaofclouds.com/jquery.tweet.js
和裝載這樣的腳本 -
$("#latest-tweet").tweet({
count: 1,
username: ["motocomdigital"],
loading_text: "searching twitter...",
});
林加載到微博#DIV最新的鳴叫是DIV#鳴叫區域內。見下面
<div id="tweet-area" class="clearfix">
<div id="latest-tweet"></div>
</div>
我用盡Twitter的腳本後,加入我的身高腳本,但仍然得到了同樣的高度:/
<script>
$(document).ready(function() {
$("#latest-tweet").tweet({
count: 1,
username: ["motocomdigital"],
loading_text: "searching twitter..."
});
var tweetheight = $("#tweet-area").height();
$("#sidebar-wrapper").css({ bottom: tweetheight});
});
</script>
任何幫助將是真棒,因爲這是對我來說有點專家。感謝沿線的這麼多
完美的傢伙,謝謝這麼多人! - 謝謝你看看,我不會發現這個處理程序 - 儘管我以前從未使用.bind,但現在肯定。 – Joshc