程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长


+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

如何在 jQuery 中做到这一点?

发布于2022-08-07 00:38     阅读(601)     评论(0)     点赞(10)     收藏(4)


我正在使用Stupid Fixed Header来修复两个表的标题。为此,我正在使用以下脚本。

$(document).ready(function(){       
    $("#table1").fixedHeader({
        height: 160,
        adjustWidth: function(th){
        if($.browser.msie){
            return $(th).width()+10;
        }
            return $(th).width();
        }
    });

    $("#table2").fixedHeader({
        height: 160,
        adjustWidth: function(th){
        if($.browser.msie){
            return $(th).width()+10;
        }
            return $(th).width();
        }
    });
})

现在的重点是,我写了两次相同的代码。一次用于 table1,然后用于 table2。可以只写一次吗?


解决方案


$("#table1, #table2").fixedHeader ...



所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:http://www.qianduanheidong.com/blog/article/381818/c517259568a52df58c42/

来源:前端黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

10 0
收藏该文
已收藏

评论内容:(最多支持255个字符)