ScrollToFixed
ScrollToFixed copied to clipboard
ScrollToFixed for <tr> element
I have recently have a issue with your plugin. I have try to implement for <tr> attribute. In my code I have many <td> inside this <tr>. Colpan and other <table> features
In my code is simply :
$('tr').scrollToFixed({
limit : $(this).parent().offset().top + $(this).parent().outerHeight(true) - 10 - $(this).outerHeight(true)
});
In line 124 of jquery-scrolltofixed.js I have add this few lines :
// Set data display for TR
if( !spacer.attr('data-display') && target.is('tr') ){
spacer.attr('data-display', target.css('display') );
}
// Set the spacer to fill the height and width of the target
// element, then display it.
spacer.css({
'display' : ( spacer.attr('data-display') && target.css('display') != 'none' && spacer.attr('data-display') != target.css('display') ? spacer.attr('data-display') : target.css('display') ),
'width' : target.outerWidth(true),
'height' : target.outerHeight(true),
'float' : target.css('float')
});
And for now every thing is fine. The problem I have discover, it's when the scrollbar go down and up many times, the <div>. created after <tr> have a display = "block" some times... But in this case, the display should be "table-row", because the <div> replace <tr>. So I have added a init value of the display to <div>.
Thanks! I will look at a way to add this to the plugin.