介于head
<head><script type="text/javascript">$(document).ready(function() {
$.twitter.start({
searchType:"searchWord",
searchObject:"google",
lang:"en",
live:"live-180",
placeHolder:"tweetContainer",
loadMSG: "Loading messages...",
imgName: "loader.gif",
total: 6,
readMore: "Read it on Twitter",
nameUser:"image",
openExternalLinks:"newWindow",
});
});</script></head>
介于body
<body>
<div id="tweetContainer"></div>
</body>
我想对tweet容器进行空检查,好像没有推文然后隐藏Div tweetContainer
答案 0 :(得分:1)
你可以这样做
if($("#tweetContainer").eq(0).html() == '')
{
//this implies there are no tweets. so do whatever you need to
$("#tweetContainer").hide();
}
希望这有帮助!
如果您需要定期执行此操作,那么您可以
function checkTweets()
{
if($("#tweetContainer").eq(0).html() == '')
{
//this implies there are no tweets. so do whatever you need to
$("#tweetContainer").hide();
}
else
$("#tweetContainer").show();
}
//fire once and then setTime out
checkTweets();
setTimeout(checkTweets,100);