固定表头之后当浏览器窗口变化时,表头与表格不对齐解决

webUi
赵桐华 5 years ago
parent 93b7fb01bf
commit 234595a9ba
  1. 14
      frontend/views/menu/index.php
  2. 22
      frontend/views/permissions/index.php

@ -101,17 +101,21 @@ use \common\libs\MyLib;
}); });
} }
$(function() { //固定表头
search(); function fix(){
//table设置一定的高度 //table设置一定的高度
var tab=$("#listTable").attr('data-height'); var tab=$("#listTable").attr('data-height');
$('.fixed-table-body').css({'height':tab-40}); $('.fixed-table-body').css({'height':tab-40});
//当浏览器窗口变化时,表头与表格不对齐解决 //当浏览器窗口变化时,表头与表格不对齐解决
$('#align').bootstrapTable(); $('.table').bootstrapTable();
$(window).resize(function () { $(window).resize(function () {
$('#align').bootstrapTable('resetView'); $('.table').bootstrapTable('resetView');
}); });
}
$(function() {
search();
fix();
}); });
</script> </script>
<?php $this->endBlock(); ?> <?php $this->endBlock(); ?>

@ -97,17 +97,21 @@ use \common\libs\MyLib;
} }
}); });
} }
//固定表头
function fix(){
//table设置一定的高度
var tab=$("#listTable").attr('data-height');
$('.fixed-table-body').css({'height':tab-40});
//当浏览器窗口变化时,表头与表格不对齐解决
$('.table').bootstrapTable();
$(window).resize(function () {
$('.table').bootstrapTable('resetView');
});
}
$(function() { $(function() {
search(); search();
fix();
//table设置一定的高度
var tab=$("#listTable").attr('data-height');
$('.fixed-table-body').css({'height':tab-40});
//当浏览器窗口变化时,表头与表格不对齐解决
$('.table').bootstrapTable();
$(window).resize(function () {
$('.table').bootstrapTable('resetView');
});
}); });
</script> </script>
<?php $this->endBlock(); ?> <?php $this->endBlock(); ?>

Loading…
Cancel
Save