<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>top: scrolls, <br>"margin-left":"20px" <br>}) <br>} <br>} else { <br>element.css({ <br>위치: pos, <br>top: top, <br>"margin-left":"20px" <br>}) <br>} <br>} ); <br>}; <br>return $(this).each(function() { <br>position($(this)); <br><br>}); <br>}; <br>$("#ding").silde(); <br></script> <br> </div>