我有JavaScript從頁面獲取scrollHeight。Django從模板寫入上下文
<script type="text/javascript">
var body = document.body,
html = document.documentElement;
var height = Math.max(body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight);
document.write(height);
</script>
在我的情況下,我需要在模板標籤中得到這個高度。是否有可能從模板編寫此scrollHeight號碼上下文?
你是指在同一頁面請求? –
是的。所以在我的模板標籤中,我可以通過scrollHeight計算頁碼。 –