<div class="codetitle"> <span><a style="CURSOR: pointer" data="99001" class="copybut" id="copybut99001" onclick="doCopy('code99001')"><u>複製程式碼</u></a></span>程式碼如下:</div> <div class="codebody" id="code99001"> <br><script type="text/javascript"> <BR>$. fn.silde = function() { <BR>var position = function(element) { <BR>var top = element.position().top, pos = element.css <BR>("position" ); <BR> $(window).scroll(function() { <BR>var scrolls = $(this).scrollTop(); <BR>if (scrolls > top) { <BR>if (window.XMLHttpRequest) { <BR>element .css({ <BR>位置: "固定", <BR>頂部: 0, <BR>左:1080, <BR>"margin-left":"0px", <br><br> }); <BR>} else { <BR>element.css({ <BR>上: 捲動, <BR>"margin-left":"20px" <BR>}); else { <BR>element.css({ <BR>}); else { <BR>element.css({ <BR>位置: pos, <BR>頂部: 頂部, <BR>"margin-left":"20px" <BR>}); ); <BR>}; <BR>return $(this).each(function( ) { <BR>position($(this)); <BR><BR>}); <br>}; <br>$("#ding").silde(); <BR></腳本> <BR><BR></script> </div>