Monday, May 21, 2012

css/jquery: Fixed when scrolling horizontally but not vertically

I have a large table with headers as the first column, and a jQuery slider plugin (from to scroll through the table horizontally while keeping the first column fixed.

However, if I try to scroll downwards (vertically) I cannot see the rest of first column (larger than the height of the screen) since it has the fixed property (css). Is there any css or jQuery trick to fix this?

CSS Code:

     table tr td:first-child { position: fixed; } 

HTML Code:

      <div id="#content-scroll">
<tr><td></td>...and many more cells</tr>
...and many more rows

jQuery Code:

             <script type="text/javascript">
$(document).ready(function() {
animate: true,
change : function (e, ui) {
var maxScroll = $("#content-scroll").prop("scrollWidth") -
scrollLeft : ui.value * (maxScroll / 100)
}, 1000);
slide : function (e, ui)
var maxScroll = $("#content-scroll").prop("scrollWidth") -
$("#content-scroll").prop('scrollLeft' ,ui.value * (maxScroll / 100));

No comments:

Post a Comment