//定位在屏幕中间
$.fn.center = function(){
var left = ($(window).width() -this.width())/2-20 ;
var top = ($(window).height() - this.height())/2;
var scrollTop = $(document).scrollTop();
return this.css( { position : 'absolute', 'top' : top + scrollTop-10,'left':left} ).show();
}
$(window).width() 代表了当前可见区域的宽度
this.width() 当前对象的宽度
$(document).scrollTop(); 滚动到某一位置的高度,从页面的最顶头至滚动到某一位置开始的高度