I need both fixed headers and fixed columns at the same time.
I want to have fixed headers (first row and first column) and a displayed scroll table at a specific point in time.
- Left containing header column
- Right, containing the title bar and table
IMP Point:
- When data moves horizontally: fixed header (first row will move accordingly)
- When data moves vertically: fixed column (first column will move accordingly)
This will allow me to scroll horizontally without moving the title column and scroll vertically without moving the title bar (by some assumptions within my parents, I think?).
PS . I searched a lot, but I could only find fixed headers or a fixed first column. I want both. Below is a script containing a fixed column. Please help me add a fixed header (first line) to it.
script: http://jsfiddle.net/cfr94p3w/
HTML code:
<div class="table-container"> <div class="headcol"> <table> <thead> <th>Room</th> </thead> <tbody> <tr> <td>Fooname</td> </tr> <tr> <td>Barname</td> </tr> <tr> <td>Barfoo</td> </tr> <tr> <td>Zorzor</td> </tr> <tr> <td>Lorname Ipsname</td> </tr> </tbody> </table> </div> <div class="right"> <table> <thead> <th>8-10</th> <th>10-12</th> <th>12-14</th> <th>14-16</th> <th>16-18</th> <th>18-20</th> </thead> <tbody> <tr> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> <td class="cell booked">Already booked</td> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> <td class="cell available">Available for booking</td> </tr> <tr> <td class="cell available">Available for booking</td> <td class="cell booked">Already booked</td> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> </tr> <tr> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> <td class="cell booked">Already booked</td> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> <td class="cell available">Available for booking</td> </tr> <tr> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> <td class="cell available">Available for booking</td> <td class="cell available">Available for booking</td> <td class="cell booked">Already booked</td> <td class="cell booked">Already booked</td> </tr> <tr> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> <td class="cell booked">Already booked</td> <td class="cell booked">Already booked</td> <td class="cell booked">Already booked</td> <td class="cell available">Available for booking</td> </tr> </tbody> </table> </div> </div>
Thank you, I have a good day.
javascript html css html5 css3
Pratik bhoir
source share