From 1904c5bf760434f5c41cbf5d5d6207059edeab9a Mon Sep 17 00:00:00 2001 From: Mark Goodyear Date: Sat, 14 Jun 2014 18:20:02 +0100 Subject: [PATCH] Compile PR fix: v1.1.1 --- CHANGELOG.md | 3 +++ bower.json | 2 +- dist/headhesive.js | 4 ++-- dist/headhesive.min.js | 4 ++-- package.json | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22ce03b..1322ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Headhesive changelog +## v1.1.1 +- [Fix] Fix class naming + ## v1.1.0 - [Feature] Call the init method interally on instance creation - [Fix] Destroy method to only destroy it's instance diff --git a/bower.json b/bower.json index 056f20a..42d36a5 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "Headhesive.js", - "version": "1.1.0", + "version": "1.1.1", "homepage": "http://markgoodyear.com/labs/headhesive/", "authors": [ "Mark Goodyear " diff --git a/dist/headhesive.js b/dist/headhesive.js index 72fbe29..df28a69 100644 --- a/dist/headhesive.js +++ b/dist/headhesive.js @@ -1,5 +1,5 @@ /*! - * headhesive v1.1.0 - An on-demand sticky header + * headhesive v1.1.1 - An on-demand sticky header * Url: http://markgoodyear.com/labs/headhesive * Copyright (c) Mark Goodyear — @markgdyr — http://markgoodyear.com * License: MIT @@ -63,7 +63,7 @@ this.options = { offset: 300, classes: { - base: "headhesive", + clone: "headhesive", stick: "headhesive--stick", unstick: "headhesive--unstick" }, diff --git a/dist/headhesive.min.js b/dist/headhesive.min.js index fb0f662..d98dd8e 100644 --- a/dist/headhesive.min.js +++ b/dist/headhesive.min.js @@ -1,7 +1,7 @@ /*! - * headhesive v1.1.0 - An on-demand sticky header + * headhesive v1.1.1 - An on-demand sticky header * Url: http://markgoodyear.com/labs/headhesive * Copyright (c) Mark Goodyear — @markgdyr — http://markgoodyear.com * License: MIT */ -!function(t,s,e){"use strict";function i(t){for(var s=0;t;)s+=t.offsetTop,t=t.offsetParent;return s}var o=function(t,s){for(var e in s)s.hasOwnProperty(e)&&(t[e]="object"==typeof s[e]?o(t[e],s[e]):s[e]);return t},n=function(t,s){var e,i,o,n=Date.now||function(){return(new Date).getTime()},l=null,c=0,h=function(){c=n(),l=null,o=t.apply(e,i),e=i=null};return function(){var r=n(),f=s-(r-c);return e=this,i=arguments,0>=f?(clearTimeout(l),l=null,c=r,o=t.apply(e,i),e=i=null):l||(l=setTimeout(h,f)),o}},l=function(){return t.pageYOffset!==e?t.pageYOffset:(s.documentElement||s.body.parentNode||s.body).scrollTop},c=function(e,i){"querySelector"in s&&"addEventListener"in t&&(this.visible=!1,this.options={offset:300,classes:{base:"headhesive",stick:"headhesive--stick",unstick:"headhesive--unstick"},throttle:250,onInit:function(){},onStick:function(){},onUnstick:function(){},onDestroy:function(){}},this.elem="string"==typeof e?s.querySelector(e):e,this.options=o(this.options,i),this.init())};c.prototype={constructor:c,init:function(){if(this.clonedElem=this.elem.cloneNode(!0),this.clonedElem.className+=" "+this.options.classes.clone,s.body.insertBefore(this.clonedElem,s.body.firstChild),"number"==typeof this.options.offset)this.scrollOffset=this.options.offset;else{if("string"!=typeof this.options.offset)throw new Error("Invalid offset: "+this.options.offset);this.scrollOffset=i(s.querySelector(this.options.offset))}this._throttleUpdate=n(this.update.bind(this),this.options.throttle),t.addEventListener("scroll",this._throttleUpdate,!1),this.options.onInit.call(this)},destroy:function(){s.body.removeChild(this.clonedElem),t.removeEventListener("scroll",this._throttleUpdate),this.options.onDestroy.call(this)},stick:function(){this.visible||(this.clonedElem.className=this.clonedElem.className.replace(new RegExp("(^|\\s)*"+this.options.classes.unstick+"(\\s|$)*","g"),""),this.clonedElem.className+=" "+this.options.classes.stick,this.visible=!0,this.options.onStick.call(this))},unstick:function(){this.visible&&(this.clonedElem.className=this.clonedElem.className.replace(new RegExp("(^|\\s)*"+this.options.classes.stick+"(\\s|$)*","g"),""),this.clonedElem.className+=" "+this.options.classes.unstick,this.visible=!1,this.options.onUnstick.call(this))},update:function(){l()>this.scrollOffset?this.stick():this.unstick()}},t.Headhesive=c}(window,document); \ No newline at end of file +!function(t,s,e){"use strict";function i(t){for(var s=0;t;)s+=t.offsetTop,t=t.offsetParent;return s}var o=function(t,s){for(var e in s)s.hasOwnProperty(e)&&(t[e]="object"==typeof s[e]?o(t[e],s[e]):s[e]);return t},n=function(t,s){var e,i,o,n=Date.now||function(){return(new Date).getTime()},l=null,c=0,h=function(){c=n(),l=null,o=t.apply(e,i),e=i=null};return function(){var r=n(),f=s-(r-c);return e=this,i=arguments,0>=f?(clearTimeout(l),l=null,c=r,o=t.apply(e,i),e=i=null):l||(l=setTimeout(h,f)),o}},l=function(){return t.pageYOffset!==e?t.pageYOffset:(s.documentElement||s.body.parentNode||s.body).scrollTop},c=function(e,i){"querySelector"in s&&"addEventListener"in t&&(this.visible=!1,this.options={offset:300,classes:{clone:"headhesive",stick:"headhesive--stick",unstick:"headhesive--unstick"},throttle:250,onInit:function(){},onStick:function(){},onUnstick:function(){},onDestroy:function(){}},this.elem="string"==typeof e?s.querySelector(e):e,this.options=o(this.options,i),this.init())};c.prototype={constructor:c,init:function(){if(this.clonedElem=this.elem.cloneNode(!0),this.clonedElem.className+=" "+this.options.classes.clone,s.body.insertBefore(this.clonedElem,s.body.firstChild),"number"==typeof this.options.offset)this.scrollOffset=this.options.offset;else{if("string"!=typeof this.options.offset)throw new Error("Invalid offset: "+this.options.offset);this.scrollOffset=i(s.querySelector(this.options.offset))}this._throttleUpdate=n(this.update.bind(this),this.options.throttle),t.addEventListener("scroll",this._throttleUpdate,!1),this.options.onInit.call(this)},destroy:function(){s.body.removeChild(this.clonedElem),t.removeEventListener("scroll",this._throttleUpdate),this.options.onDestroy.call(this)},stick:function(){this.visible||(this.clonedElem.className=this.clonedElem.className.replace(new RegExp("(^|\\s)*"+this.options.classes.unstick+"(\\s|$)*","g"),""),this.clonedElem.className+=" "+this.options.classes.stick,this.visible=!0,this.options.onStick.call(this))},unstick:function(){this.visible&&(this.clonedElem.className=this.clonedElem.className.replace(new RegExp("(^|\\s)*"+this.options.classes.stick+"(\\s|$)*","g"),""),this.clonedElem.className+=" "+this.options.classes.unstick,this.visible=!1,this.options.onUnstick.call(this))},update:function(){l()>this.scrollOffset?this.stick():this.unstick()}},t.Headhesive=c}(window,document); \ No newline at end of file diff --git a/package.json b/package.json index a505a0f..646668f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "headhesive", "description": "An on-demand sticky header", - "version": "1.1.0", + "version": "1.1.1", "author": { "name": "Mark Goodyear", "url": "http://markgoodyear.com",