<div class="codetitle"> <span><a style="CURSOR: pointer" data="75179" class="copybut" id="copybut75179" onclick="doCopy('code75179')"><u>複製程式碼</u></a></span>如下程式碼:</div> <div class="codebody" id="code75179"> <br>#topmenu{position:absolute;top:100px; ;寬度:100%;邊距:0 自動;清除:兩者;溢:隱藏;z-index:998;左:0} <br><br><script type="text/javascript"> <BR> jQuery(document).ready(function() { <BR>var topmenu = jQuery("#topmenu"); <BR>var topmenu_top = topmenu.offset().top; <BR>reset_topmenu_top(topmenu, topmenutop_top); <BR>jQuery(window).scroll(function() { <BR>reset_topmenu_top(topmenu, topmenu_top); <BR>}); <BR>函式reset_topmenu_top(topmenu, topmenu_top) { <p ).scrollTop(); <BR>if (document_scroll_top > topmenu_top) { <BR>topmenu.css('top', document_scroll_top); <BR>} <topmen🎜>if (document_scroll_top <top css('top', topmenu_top); <BR>} <BR>} <BR></腳本> <BR><BR> <BR>效果圖如下:<BR><BR></script> </div>