-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Horizontal scroll not working #11
Comments
I do not remember.. But... Do you tried put it after freeze header initialization (of course, inside in document.ready)? Yeah, i know.. My english is not perfect :DDD, sorry |
I was playing around with this last night and here is the code that I changed to enable horizontal scrolling. Sorry, no time for a pull request right now... Here is what it looks like: Starting at line 60 of if (obj.header.offset() != null) {
if (limiteAlcancado(obj, params)) {
if (!copiedHeader) {
cloneHeaderRow(obj);
copiedHeader = true;
}
// The following line was added - waynebloss
obj.container.css("left", ("-" + document.body.scrollLeft.toString() + "px"));
}
else {
if (($(document).scrollTop() > obj.header.offset().top)) {
obj.container.css("position", "absolute");
obj.container.css("top", (obj.grid.find("tr:last").offset().top - obj.header.height()) + "px");
// The same exact line was added here (yuck!) - waynebloss
obj.container.css("left", ("-" + document.body.scrollLeft.toString() + "px"));
}
else {
obj.container.css("visibility", "hidden");
obj.container.css("top", "0px");
obj.container.width(0);
}
copiedHeader = false;
}
} I did not use the included style.css file from the freezeheader repository, instead I used Bootstrap and here is the HTML for the demo shown above: <!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='//code.jquery.com/jquery-2.1.3.js'></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script type="text/javascript" src="js/jquery.freezeheader.js"></script>
<!-- link rel="stylesheet" type="text/css" href="css/style.css" / -->
<style type="text/css">
.navbar { margin-bottom: 0 !important; }
body { padding-top: 50px; }
</style>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#table1").freezeHeader({offset: '50px'});
})
</script>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Title, Navbars, Menus, etc...</a>
</div>
</div>
</div>
<table class="table" style="min-width: 1000px" id="table1">
<thead>
<tr style="background-color:white;">
<th style='width: 250px'>
Culture Name
</th>
<th style='width: 250px'>
Display Name
</th>
<th style='width: 250px'>
Culture Code
</th>
<th style='width: 250px'>
ISO 639x
</th>
</tr>
</thead>
<tbody>
<tr class="grid">
<td>
hr-HR
</td>
<td>
Croatian - Croatia
</td>
<td>
0x041A
</td>
<td>
HRV
</td>
</tr>
<!-- Lots more rows go here, get them from freezeheader repo index.html file. -->
</tbody>
</table>
</body>
</html> |
very good! with a small change //at line 46: // The following line was added - waynebloss I will publish your changes using the bootstrap. 2015-11-03 23:35 GMT-02:00 Wayne Bloss notifications@github.com:
att, Laerte Mercier Junior |
One more change. Subtracting obj.container.css('left', '-' + (obj.scroller.scrollLeft() - obj.grid.position().left) + 'px'); There may be a better way to do all of this, but it's working for me right now. (UPDATE: This addition does not work.) |
The most recent addition that I noted earlier does not actually work. Any suggestions on how to account for horizontal padding on the left would be appreciated. If I find something I will post it here. |
The code that is working the best for me is the line from #2: obj.container.css('left', (window.pageXOffset * -1) + obj.grid.offset().left); |
…rom waynebloss on Nov 4 in laertejjunior#11
Hi all |
@saxrub Here is an alternative - http://mkoryak.github.io/floatThead/ |
Whats the change that got horizontal scroll working here's what I tried `(function ($) {
})(jQuery);` |
Hello, it's possible to have the final fixed code? I tried to apply the fix on the existing but it didn't work. You would be of great help to me. Thanks. |
Hello, if the table doesn't fit horizontally in the screen, the horizontal scroll bar doesn't work. It shows only the first left columns. #2 talk about it, but I don't understand where to put that fix code?
The text was updated successfully, but these errors were encountered: