我有一个带有jquery和slim框架的简单代码,这里是:
jquery的:
var auto_refresh = setInterval(
function ()
{
$('#counter').load('/requests/autoloader').fadeIn("slow");
}, 5000);
/requests/autoloader
路线
$stat = 1;
$requests = $dbh->prepare("SELECT COUNT(*) FROM encashments WHERE status = ? ");
$requests->execute(array($stat));
$reqs = $requests->fetchColumn();
echo $reqs;
我的HTML:
<li role="presentation"><a href="/user/admin/encashment/requests">Encashment Requests <div id="counter" style="color:red;"></div></a></li>
一切都运转良好,但我想知道为什么div移动到下一行?看起来像这样:
正如您所看到的,该数字低于Encashment Requests
链接,我希望它只是在它旁边。我该怎么做?谢谢。
答案 0 :(得分:2)
尝试将#counter
css
财产display
设为inline-block
#counter {
display:inline-block;
}
&#13;
<li role="presentation"><a href="/user/admin/encashment/requests">Encashment Requests <div id="counter" style="color:red;">3</div></a></li>
&#13;