悬浮窗口的代码:
<style type="text/css">
.navontop{position:fixed;top:0;margin-left:auto;margin-right:auto;width:300px;z-index:999;}</style>
<script type="text/javascript">
jQuery(document).ready(function(){
var navtop=jQuery("#nv").offset().top;
jQuery(window).scroll(function(){
var temp=jQuery(this).scrollTop();
if(temp>navtop)
jQuery("#nv").addClass("navontop");
else
jQuery("#nv").removeClass("navontop");
});
});</script>
最后在哪个窗口上加上一个ID就好了
<div id="nv">
详情请参考:
http://www.bo-yi.com/edu/show-92.html