/*
* Auther:zhaohailong
* Date: 2017-09-05
*/
/*
主要思想:
1>将原有的TABLE中的THEAD元素复制一份放在一个新的DIV(fixedheadwrap)中
2>设置这个fixedheadwrap为绝对位于原来的TABLE的THEAD位置
*/
(function ($) {
$.fn.extend({
FixedHead: function (options) {
var op = $.extend({ tableLayout: "auto" }, options);
return this.each(function () {
var $this = $(this); //指向当前的table
var $thisParentDiv = $(this).parent(); //指向当前table的父级DIV,这个DIV要自己手动加上去
//以防重复调用多次生成
if($thisParentDiv.siblings(".fixedheadwrap").length>0){
//alert($thisParentDiv[0].clientWidth+" "+$thisParentDiv.siblings(".fixedheadwrap")[0].clientWidth);
//if($thisParentDiv[0].clientWidth!=$thisParentDiv.siblings(".fixedheadwrap")[0].clie
表格添加固定表头,js 实现 tableFixedHead.js
最新推荐文章于 2022-09-07 10:04:36 发布