Table With Fixed Header And Column - Ie8 Optimization
I have created layout that looks like this: This is how it works: As You can see header is fixed but scrollable, the same behaviour is for 1 column. Here is code for this demo: h
Solution 1:
You might want to take a look at a framework like Bootstrap or similar. Responsive/fluid layouts are in there working out of the box.
Solution 2:
I've managed to do all fixes with css and jQuery. http://jsfiddle.net/Misiu/9j5Xy/26/
This is my jQuery code:
$(document).ready(function () {
functionscrollHandler(e) {
$('#row').css('left', -$('#table').get(0).scrollLeft);
$('#col').css('top', -$('#table').get(0).scrollTop);
}
$('#table').scroll(scrollHandler);
$('#table').resize(scrollHandler);
var animate = false;
$('#wrapper').keydown(function (event) {
if (animate) {
event.preventDefault();
};
if (event.keyCode == 37 && !animate) {
animate = true;
$('#table').animate({
scrollLeft: "-=200"
}, "fast", function () {
animate = false;
});
event.preventDefault();
} elseif (event.keyCode == 39 && !animate) {
animate = true;
$('#table').animate({
scrollLeft: "+=200"
}, "fast", function () {
animate = false;
});
event.preventDefault();
} elseif (event.keyCode == 38 && !animate) {
animate = true;
$('#table').animate({
scrollTop: "-=200"
}, "fast", function () {
animate = false;
});
event.preventDefault();
} elseif (event.keyCode == 40 && !animate) {
animate = true;
$('#table').animate({
scrollTop: "+=200"
}, "fast", function () {
animate = false;
});
event.preventDefault();
}
});
});
But comments and optimizations are always welcome :)
Post a Comment for "Table With Fixed Header And Column - Ie8 Optimization"