【发布时间】:2011-12-31 11:11:54
【问题描述】:
我刚刚意识到我在最后一个问题上搞砸了。
我正在使用下面的脚本来获取 DIV#tweet-area 上的动态高度并将该高度插入 CSS。
var tweetheight = $("#tweet-area").height();
$("#sidebar-wrapper").css({ bottom: tweetheight});
它很漂亮,但我刚刚意识到它的高度是加载我的 twitter 内容之前 div 的高度。我的 twitter 内容是由一个 jQuery 插件生成的,见下文。
我正在使用这个 jQuery 推特插件 - tweet.seaofclouds.com/jquery.tweet.js
并像这样加载脚本 -
$("#latest-tweet").tweet({
count: 1,
username: ["motocomdigital"],
loading_text: "searching twitter...",
});
我正在将推文加载到位于 DIV#tweet-area 内的 DIV#latest-tweet 中。见下文
<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>
任何帮助都会很棒,因为这对我来说是个小专家。非常感谢
【问题讨论】:
标签: jquery dom html height var