Giter Site home page Giter Site logo

han8435762 / table-fixed-header Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rubynor/table-fixed-header

1.0 1.0 0.0 65 KB

Keep table header visible when page scrolls. Supports rowspan and colspan. The table header will be fixed once hitting the screen top. Example with twitter bootstrap

CSS 85.87% JavaScript 1.57% HTML 12.56%

table-fixed-header's Introduction

http://github.com/oma/table-fixed-header

Freeze table header at top of the page when scrolling.

jQuery Plugin for 'freezing' the table header when the page is scrolled and the header would otherwise disappear.

See LIVE example here http://rubynor.com/table-fixed-header/example.html

For solution to enable independent scrolling of table body only, this is not it. You might want to look at chromatable or other. To be honest, we tried those too, but they didn't handle big tables with colspans and rowspans very well.

Works with multiple header rows and colspan

Using :colspan => 1 and :rowspan => 2 and multiple tr and th works. This was what we needed ourselves.

See example.html.haml

#Example

open example.html to check out the behavior.

The html is generated from the HAML using haml example.html.haml > example.html

#Usage

include the javascript or coffeescript file in your path.

add the css class 'table-fixed-header' to your table. Add the class 'header' to your thead.

%table.table-fixed-header
  %thead.header
    %tr
      %th header1
      %th header2
  %tbody
    %tr
      %td val1
      %td val2
    %tr
      %td val3
      %td val4

Trigger the header freeze with this:

$('.table-fixed-header').fixedHeader()

#Credits

Thanks to https://github.com/i-scorpion for the initial solution https://gist.github.com/2948136 Thanks to https://github.com/alexrolls for the skype share screen sessions and discussions

#License

MIT license http://opensource.org/licenses/MIT

please keep contributing by sharing code :-)

table-fixed-header's People

Contributors

alexrolls avatar bjorntrondsen avatar craigtp avatar devantoine avatar hayk avatar jeffencheung avatar nyjt avatar oma avatar zo103181 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.