bootstrap表頭表列固定后,列水平滾動表頭不滾動的解決方法


$.extend($.fn.bootstrapTable.defaults, {

stickyHeader: false,

stickyHeaderOffsetY: 0,

fixedColumns: true, //固定列

fixedNumber: 4 //固定第3列

});

{ key: 'matchPositionX', value: function matchPositionX() {

var left = this.$tableBody.scrollLeft(); this.$stickyContainer.scrollLeft(left);

//是否有固定表列 if (this.options.fixedColumns === true) {

var fixedNumber = this.options.fixedNumber;

this.$stickyHeader.find('tr:eq(0)').find('th').each(function (index, el) {

$(el).css("background-color", "white");

$(el).css("position", "relative");

$(el).css("z-index", "100");

//大於設置的固定表列,設置滾動

if (index >= fixedNumber) {

$(el).css('transform', 'translateX(-' + left + 'px)');

$(el).css("z-index", "99"); } }); } } }

 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM