Skip to content

Commit

Permalink
fix #487 Multiple tables within a scrollable div
Browse files Browse the repository at this point in the history
This is now fixed for `absolute` positioning mode. I am not even going to attempt to fix it for `fixed` because this code looks like it was written by someone else :)
  • Loading branch information
mkoryak authored Mar 10, 2023
1 parent 3c8555b commit 4a6792b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/jquery.floatThead.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @preserve jQuery.floatThead 2.2.2 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2021 Misha Koryak **/
/** @preserve jQuery.floatThead 2.2.3 - https://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2023 Misha Koryak **/
// @license MIT

/* @author Misha Koryak
Expand Down Expand Up @@ -106,7 +106,6 @@

var globalCanObserveMutations = typeof MutationObserver !== 'undefined';


//browser stuff
var ieVersion = function(){for(var a=3,b=document.createElement("b"),c=b.all||[];a = 1+a,b.innerHTML="<!--[if gt IE "+ a +"]><i><![endif]-->",c[0];);return 4<a?a:document.documentMode}();
var isFF = /Gecko\//.test(navigator.userAgent);
Expand Down Expand Up @@ -195,7 +194,6 @@
return $(parent);
}


function debug(str){
window && window.console && window.console.error && window.console.error("jQuery.floatThead: " + str);
}
Expand Down Expand Up @@ -350,8 +348,6 @@

var useAbsolutePositioning = null;



if (opts.position === 'auto') {
useAbsolutePositioning = null;
} else if (opts.position === 'fixed') {
Expand Down Expand Up @@ -468,7 +464,6 @@
$table.before($floatContainer);
}


$floatContainer.css({
position: useAbsolutePositioning ? 'absolute' : 'fixed',
marginTop: '0',
Expand Down Expand Up @@ -504,7 +499,6 @@
$sizerCells.outerHeight(headerHeight);
}


function setFloatWidth(){
var tw = tableWidth($table, $fthCells, true);
var $container = responsive ? $responsiveContainer : $scrollContainer;
Expand Down Expand Up @@ -797,7 +791,7 @@
triggerFloatEvent(false);
} else if(scrollingContainerTop - tableContainerGap > tableHeight - floatContainerHeight){
// scrolled past table but there is space in the container under it..
top = tableHeight - floatContainerHeight - scrollingContainerTop - tableContainerGap;
top = tableHeight - floatContainerHeight - scrollingContainerTop + tableContainerGap;
} else {
top = wrappedContainer ? tableTopGap : scrollingContainerTop;
//headers stop at the top of the viewport
Expand Down Expand Up @@ -998,7 +992,6 @@
}
////// end printing stuff


if(locked){ //internal scrolling
if(useAbsolutePositioning){
$scrollContainer.on(eventName('scroll'), containerScrollEvent);
Expand Down Expand Up @@ -1029,7 +1022,6 @@
$window.on(eventName('tabsactivate'), reflowEvent); // same thing for jqueryui
}


if (canObserveMutations) {
var mutationElement = null;
if(util.isFunction(opts.autoReflow)){
Expand Down

0 comments on commit 4a6792b

Please sign in to comment.