diff --git a/Gruntfile.js b/Gruntfile.js index 86fe3fe..0e586c0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,7 +4,7 @@ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ meta: { - version: '0.1.8', + version: '0.1.9', source: 'jquery.stickytableheaders.js', sourceMin: 'jquery.stickytableheaders.min.js' }, diff --git a/StickyTableHeaders.jquery.json b/StickyTableHeaders.jquery.json index 6b03c48..a248474 100644 --- a/StickyTableHeaders.jquery.json +++ b/StickyTableHeaders.jquery.json @@ -8,7 +8,7 @@ "fixed", "scroll" ], - "version": "0.1.8", + "version": "0.1.9", "author": { "name": "Jonas Mosbech", "url": "https://twitter.com/jmosbech/" diff --git a/bower.json b/bower.json index 730d5c7..86ad6bb 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "StickyTableHeaders", - "version": "0.1.8", + "version": "0.1.9", "homepage": "https://github.com/jmosbech/StickyTableHeaders", "authors": [ "Jonas Mosbech " diff --git a/js/jquery.stickytableheaders.min.js b/js/jquery.stickytableheaders.min.js index b03ca45..ef9d4af 100644 --- a/js/jquery.stickytableheaders.min.js +++ b/js/jquery.stickytableheaders.min.js @@ -1 +1 @@ -!function(a,b){"use strict";function c(c,g){var h=this;h.$el=a(c),h.el=c,h.id=e++,h.$el.bind("destroyed",a.proxy(h.teardown,h)),h.$clonedHeader=null,h.$originalHeader=null,h.isSticky=!1,h.hasBeenSticky=!1,h.leftOffset=null,h.topOffset=null,h.init=function(){h.options=a.extend({},f,g),h.$el.each(function(){var b=a(this);b.css("padding",0),h.$scrollableArea=a(h.options.scrollableArea),h.$originalHeader=a("thead:first",this),h.$clonedHeader=h.$originalHeader.clone(),b.trigger("clonedHeader."+d,[h.$clonedHeader]),h.$clonedHeader.addClass("tableFloatingHeader"),h.$clonedHeader.css("display","none"),h.$originalHeader.addClass("tableFloatingHeaderOriginal"),h.$originalHeader.after(h.$clonedHeader),h.$printStyle=a(''),a("head").append(h.$printStyle)}),h.updateWidth(),h.toggleHeaders(),h.bind()},h.destroy=function(){h.$el.unbind("destroyed",h.teardown),h.teardown()},h.teardown=function(){h.isSticky&&h.$originalHeader.css("position","static"),a.removeData(h.el,"plugin_"+d),h.unbind(),h.$clonedHeader.remove(),h.$originalHeader.removeClass("tableFloatingHeaderOriginal"),h.$originalHeader.css("visibility","visible"),h.$printStyle.remove(),h.el=null,h.$el=null},h.bind=function(){h.$scrollableArea.on("scroll."+d,h.toggleHeaders),h.$scrollableArea[0]!==b&&(a(b).on("scroll."+d+h.id,h.setPositionValues),a(b).on("resize."+d+h.id,h.toggleHeaders)),h.$scrollableArea.on("resize."+d,h.toggleHeaders),h.$scrollableArea.on("resize."+d,h.updateWidth)},h.unbind=function(){h.$scrollableArea.off("."+d,h.toggleHeaders),h.$scrollableArea[0]!==b&&(a(b).off("."+d+h.id,h.setPositionValues),a(b).off("."+d+h.id,h.toggleHeaders)),h.$scrollableArea.off("."+d,h.updateWidth),h.$el.off("."+d),h.$el.find("*").off("."+d)},h.toggleHeaders=function(){h.$el&&h.$el.each(function(){var c,d=a(this),e=h.$scrollableArea[0]===b?isNaN(h.options.fixedOffset)?h.options.fixedOffset.height():h.options.fixedOffset:h.$scrollableArea.offset().top+(isNaN(h.options.fixedOffset)?0:h.options.fixedOffset),f=d.offset(),g=h.$scrollableArea.scrollTop()+e,i=h.$scrollableArea.scrollLeft(),j=h.$scrollableArea[0]===b?g>f.top:e>f.top,k=(h.$scrollableArea[0]===b?g:0)c||c+a(b).height()>a(document).height()||0>d||d+a(b).width()>a(document).width()||h.$originalHeader.css({top:h.topOffset-(h.$scrollableArea[0]===b?0:c),left:h.leftOffset-(h.$scrollableArea[0]===b?0:d)})},h.updateWidth=function(){if(h.isSticky){h.$originalHeaderCells||(h.$originalHeaderCells=a("th,td",h.$originalHeader)),h.$clonedHeaderCells||(h.$clonedHeaderCells=a("th,td",h.$clonedHeader));var b=h.getWidth(h.$clonedHeaderCells);h.setWidth(b,h.$clonedHeaderCells,h.$originalHeaderCells),h.$originalHeader.css("width",h.$clonedHeader.width())}},h.getWidth=function(b){var c=[];return b.each(function(b){var d,e=a(this);d="border-box"===e.css("box-sizing")?e.outerWidth():e.width(),c[b]=d}),c},h.setWidth=function(a,b,c){b.each(function(b){var d=a[b];c.eq(b).css({"min-width":d,"max-width":d})})},h.resetWidth=function(b,c){b.each(function(b){var d=a(this);c.eq(b).css({"min-width":d.css("min-width"),"max-width":d.css("max-width")})})},h.updateOptions=function(b){h.options=a.extend({},f,b),h.updateWidth(),h.toggleHeaders()},h.init()}var d="stickyTableHeaders",e=0,f={fixedOffset:0,leftOffset:0,scrollableArea:b};a.fn[d]=function(b){return this.each(function(){var e=a.data(this,"plugin_"+d);e?"string"==typeof b?e[b].apply(e):e.updateOptions(b):"destroy"!==b&&a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window); \ No newline at end of file +!function(a,b){"use strict";function c(c,g){var h=this;h.$el=a(c),h.el=c,h.id=e++,h.$el.bind("destroyed",a.proxy(h.teardown,h)),h.$clonedHeader=null,h.$originalHeader=null,h.isSticky=!1,h.hasBeenSticky=!1,h.leftOffset=null,h.topOffset=null,h.init=function(){h.options=a.extend({},f,g),h.$el.each(function(){var b=a(this);b.css("padding",0),h.$scrollableArea=a(h.options.scrollableArea),h.$originalHeader=a("thead:first",this),h.$clonedHeader=h.$originalHeader.clone(),b.trigger("clonedHeader."+d,[h.$clonedHeader]),h.$clonedHeader.addClass("tableFloatingHeader"),h.$clonedHeader.css("display","none"),h.$originalHeader.addClass("tableFloatingHeaderOriginal"),h.$originalHeader.after(h.$clonedHeader),h.$printStyle=a(''),a("head").append(h.$printStyle)}),h.updateWidth(),h.toggleHeaders(),h.bind()},h.destroy=function(){h.$el.unbind("destroyed",h.teardown),h.teardown()},h.teardown=function(){h.isSticky&&h.$originalHeader.css("position","static"),a.removeData(h.el,"plugin_"+d),h.unbind(),h.$clonedHeader.remove(),h.$originalHeader.removeClass("tableFloatingHeaderOriginal"),h.$originalHeader.css("visibility","visible"),h.$printStyle.remove(),h.el=null,h.$el=null},h.bind=function(){h.$scrollableArea.on("scroll."+d,h.toggleHeaders),h.isWindowScrolling()||(a(b).on("scroll."+d+h.id,h.setPositionValues),a(b).on("resize."+d+h.id,h.toggleHeaders)),h.$scrollableArea.on("resize."+d,h.toggleHeaders),h.$scrollableArea.on("resize."+d,h.updateWidth)},h.unbind=function(){h.$scrollableArea.off("."+d,h.toggleHeaders),h.isWindowScrolling()||(a(b).off("."+d+h.id,h.setPositionValues),a(b).off("."+d+h.id,h.toggleHeaders)),h.$scrollableArea.off("."+d,h.updateWidth),h.$el.off("."+d),h.$el.find("*").off("."+d)},h.toggleHeaders=function(){h.$el&&h.$el.each(function(){var b,c=a(this),d=h.isWindowScrolling()?isNaN(h.options.fixedOffset)?h.options.fixedOffset.height():h.options.fixedOffset:h.$scrollableArea.offset().top+(isNaN(h.options.fixedOffset)?0:h.options.fixedOffset),e=c.offset(),f=h.$scrollableArea.scrollTop()+d,g=h.$scrollableArea.scrollLeft(),i=h.isWindowScrolling()?f>e.top:d>e.top,j=(h.isWindowScrolling()?f:0)c||c+a(b).height()>a(document).height()||0>d||d+a(b).width()>a(document).width()||h.$originalHeader.css({top:h.topOffset-(h.isWindowScrolling()?0:c),left:h.leftOffset-(h.isWindowScrolling()?0:d)})},h.updateWidth=function(){if(h.isSticky){h.$originalHeaderCells||(h.$originalHeaderCells=a("th,td",h.$originalHeader)),h.$clonedHeaderCells||(h.$clonedHeaderCells=a("th,td",h.$clonedHeader));var b=h.getWidth(h.$clonedHeaderCells);h.setWidth(b,h.$clonedHeaderCells,h.$originalHeaderCells),h.$originalHeader.css("width",h.$clonedHeader.width())}},h.getWidth=function(b){var c=[];return b.each(function(b){var d,e=a(this);d="border-box"===e.css("box-sizing")?e.outerWidth():e.width(),c[b]=d}),c},h.setWidth=function(a,b,c){b.each(function(b){var d=a[b];c.eq(b).css({"min-width":d,"max-width":d})})},h.resetWidth=function(b,c){b.each(function(b){var d=a(this);c.eq(b).css({"min-width":d.css("min-width"),"max-width":d.css("max-width")})})},h.updateOptions=function(b){h.options=a.extend({},f,b),h.updateWidth(),h.toggleHeaders()},h.init()}var d="stickyTableHeaders",e=0,f={fixedOffset:0,leftOffset:0,scrollableArea:b};a.fn[d]=function(b){return this.each(function(){var e=a.data(this,"plugin_"+d);e?"string"==typeof b?e[b].apply(e):e.updateOptions(b):"destroy"!==b&&a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window); \ No newline at end of file diff --git a/package.json b/package.json index 78d9570..c4ab12a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "keywords" : ["jquery", "sticky", "table", "headers"], "repository" : "https://github.com/jmosbech/StickyTableHeaders", "author" : "Jonas Mosbech ", - "version" : "0.1.8", + "version" : "0.1.9", "devDependencies": { "grunt": "0.4.0", "grunt-contrib-jshint": "~0.3.0",