[JavaScript] jQuery控制网页中指定元素居中显示 →→→→→进入此内容的聊天室

来自 , 2019-07-02, 写在 JavaScript, 查看 116 次.
URL http://www.code666.cn/view/46f5ffb3
  1. jQuery.fn.center = function () {
  2.     this.css("position","absolute");
  3.     this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) +
  4.                                                 $(window).scrollTop()) + "px");
  5.     this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) +
  6.                                                 $(window).scrollLeft()) + "px");
  7.     return this;
  8. }
  9.  
  10.  
  11. //javascript/8313

回复 "jQuery控制网页中指定元素居中显示"

这儿你可以回复上面这条便签

captcha