我有一個div
需要被垂直居中在屏幕頁面滾動股利需要滾動頁面後,屏幕的垂直中心
這裏後是一個演示 - http://jsfiddle.net/JtZ7F/
<div style="height:1000px; border:1px solid red;">
scroll
<span style="height:150px; width:100px; float:right; border:1px solid green; display:block; position:fixed;top:50%; margin-top:-75px;">
need vertical center of the screen after page scroling
</span>
</div>
現在我使用position:fixed;
,這不是一個解決方案
我想停止頁面滾動時,我的綠色框順利地移動到屏幕的垂直中心。
我該如何在jQuery中做到這一點?
,你能否告訴jQuery的工作,你已經完成的工作? –
爲什麼'position:fixed'不是您的解決方案? –
@Liam Spencer - 其實我不是jQuery專家。你有沒有簡單的腳本? – ShibinRagh