Skip to content

Commit

Permalink
Merge branch 'florianherrengt-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jmosbech committed May 21, 2015
2 parents 4d9967b + b2ec171 commit 3a34833
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions demo/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,17 @@ <h1>Playground</h1>
</tr>
</tbody>
</table>
<div style="height:2000px"></div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="../js/jquery.stickytableheaders.js"></script>
<script>
$('table').on('clonedHeader.stickyTableHeaders', function(table, $clone){
console.log('header cloned', $clone);
$('table').on('clonedHeader.stickyTableHeaders', function(event){
console.log('header cloned', event);
}).on('enabledStickiness.stickyTableHeaders', function(event){
console.log('enabledStickiness', event);
}).on('disabledStickiness.stickyTableHeaders', function(event){
console.log('disabledStickiness', event);
});
$('table').stickyTableHeaders();
</script>
Expand Down
2 changes: 2 additions & 0 deletions js/jquery.stickytableheaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@
base.isSticky = true;
// make sure the width is correct: the user might have resized the browser while in static mode
base.updateWidth();
$this.trigger('enabledStickiness.' + name);
}
base.setPositionValues();
} else if (base.isSticky) {
base.$originalHeader.css('position', 'static');
base.$clonedHeader.css('display', 'none');
base.isSticky = false;
base.resetWidth($('td,th', base.$clonedHeader), $('td,th', base.$originalHeader));
$this.trigger('disabledStickiness.' + name);
}
});
}
Expand Down
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ As described in [pull request #33](https://github.com/jmosbech/StickyTableHeader
$('table').stickyTableHeaders({fixedOffset: [new-offset]});
```

###Events
The plugin triggers the following events on the targeted `<table>` element:

- `clonedHeader.stickyTableHeaders`: When the header clone is created.
- `enabledStickiness.stickyTableHeaders`: When the sticky header is enabled.
- `disabledStickiness.stickyTableHeaders`: When the sticky header is disabled.

Confused?
---------

Expand Down

0 comments on commit 3a34833

Please sign in to comment.