您的位置:首页 > Web前端 > JQuery

jquery使用技巧

2011-10-12 17:32 239 查看
 使元素居于屏幕中间 \$(document).ready(function() {   

jQuery.fn.center = function () {   
this.css("position","absolute");   
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
  
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
  
return this;   
}   
$("#id").center();   
});   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jquery function