fastadmin 表头悬浮固定顶部

本文介绍如何在Fastadmin中实现表格表头在滚动时悬浮并固定在顶部的功能,通过在模块控制器的js指数方法内添加特定代码来完成。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

fastadmin 表头悬浮固定顶部

将下述代码放到模块控制器js中的index方法内:

$(function(){
   
  var sourceTable = $("#table");//table id
  var sourceTableHead = $("#table thead tr");//table thead tr id
  var headHeight = sourceTableHead.height();//table thead tr height


  //copy table and thead html tag from source table,
  $('body').append('<div id="shelter" style="display:none;padding-left:30px;"><table id="fixed_table"  border="0" cellpadding="4" cellspacing="0" class="table table-hover"><thead></thead></table></div>');
  //only set top and left,beacuse i need the top bar can scroll left
  $("#shelter").css({
   'height':headHeight,'position':'fixed','top'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值