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.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();
});
相关文章推荐
- VS2010技巧:如何在js文件中使用jQuery智能感知
- jquery使用技巧简介
- JQuery的使用技巧
- 26 个 jQuery使用技巧
- jQuery使用技巧
- Jquery使用小技巧汇总
- jquery thickbox的一些使用技巧
- 12个Jquery使用技巧
- jquery中EasyUI使用技巧小结
- Visual Studio下使用jQuery的10个技巧
- jquery的26个使用技巧
- jquery使用技巧(2)
- 使用 jQuery 复制文字到剪贴板的技巧
- GBin1分享:jQuery新手技巧之“避免过多使用$('.someclass')”
- jquery使用技巧-不断更新中
- jQuery使用注意点技巧2——jQuery 选择器详解
- 转转转转——使用的Jquery技巧
- jquery的选择器的使用技巧之如何选择input框
- jquery使用指南与技巧
- JQuery中Ajax功能的使用技巧二则