标签:scrolltop logs for find index head extend var jquer
/*20170628固定表格列*/ ;(function($){ $.fn.Scrollhanle=function(set){ var opt=$.extend({ size:3 },set||{}); return this.each(function(){ var sleft=$(this); var $color=‘#FFF‘; var $headtr=sleft.find(‘thead>tr‘); var $tbody=sleft.find(‘tbody tr‘); sleft.scroll(function(){ var scrollTopval=sleft.scrollTop(); var scrollLeftval=sleft.scrollLeft(); $headtr.css(‘background‘,$color)[0].style.transform=‘translateY(‘+scrollTopval+‘px)‘; if(scrollLeftval>=0){ $tbody.each(function(e){ $color2=$(this).css(‘background-color‘); $(this).children(‘td‘).slice(0,opt.size).each(function(index){ $headtr.children(‘th‘).eq(index).css(‘background‘,$color)[0].style.transform=‘translateX(‘+scrollLeftval+‘px)‘; $(this).css(‘background‘,$color2)[0].style.transform=‘translateX(‘+scrollLeftval+‘px)‘; }) }) } }) }) } })(jQuery)
标签:scrolltop logs for find index head extend var jquer
原文地址:http://www.cnblogs.com/chenglideyueguang/p/7088496.html