$.fn.smartfloat = function() { var position = function(element) { var top = element.position().top, pos = element.css("position"); $(window).scroll(function() { var scrolls = $(this).scrolltop(); if (scrolls > 702) { if (window.xmlhttprequest) { element.css({ display:"block", position: "fixed", top: 0 }); } else { element.css({ display:"none", top: scrolls }); } }else { element.css({ display:"none", position: pos, top: top }); } }); }; return $(this).each(function() { position($(this)); }); }; //���÷��� //$("#fixed").smartfloat();