From 179f8cc5dce87d4584bfb8abf4cebc9b6f785b7b Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Tue, 17 Dec 2013 11:51:58 +0100
Subject: [PATCH 01/17] positioning css updated, better userAgent regex
---
jquery.lockfixed.js | 10 ++++++----
jquery.lockfixed.min.js | 7 +++----
lockfixed.jquery.json | 2 +-
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index aa6b8cf..69d9253 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -6,7 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sun Jan 27 2013 12:00:00 GMT
+ * Date: Thue Dec 12 2013 12:00:00 GMT
*/
(function($, undefined){
$.extend({
@@ -25,7 +25,6 @@
var el =$(el);
if(el && el.offset()){
var el_top = el.offset().top,
- el_left = el.offset().left,
el_height = el.outerHeight(true),
el_width = el.outerWidth(),
el_position = el.css("position"),
@@ -38,14 +37,17 @@
/* we prefer feature testing, too much hassle for the upside */
/* while prettier to use position: fixed (less jitter when scrolling) */
- /* iOS 5+ + Andriud has fixed support, but issue with toggeling between fixed and not and zoomed view, is iOs only calls after scroll is done, so we ignore iOS 5 for now */
- if (config.forcemargin === true || navigator.userAgent.match(/\bMSIE (4|5|6)\./) || navigator.userAgent.match(/\bOS (3|4|5|6)_/) || navigator.userAgent.match(/\bAndroid (1|2|3|4)\./i)){
+ /* iOS 5+ + Android has fixed support, but issue with toggeling between fixed and not and zoomed view */
+ if (config.forcemargin === true || navigator.userAgent.match(/\bMSIE (4|5|6)\./) || navigator.userAgent.match(/\bOS ([0-9])_/) || navigator.userAgent.match(/\bAndroid ([0-9])\./i)){
pos_not_fixed = true;
}
$(window).bind('scroll resize orientationchange load',el,function(e){
var el_height = el.outerHeight(),
scroll_top = $(window).scrollTop();
+
+ // check height on load event (specifically) due to elements being hidden on DOM ready - is this case, the height value is incorrect)
+ max_height = $(document).height() - config.offset.bottom;
//if we have a input focus don't change this (for ios zoom and stuff)
if(pos_not_fixed && document.activeElement && document.activeElement.nodeName === "INPUT"){
diff --git a/jquery.lockfixed.min.js b/jquery.lockfixed.min.js
index fa497d5..1d2ae52 100644
--- a/jquery.lockfixed.min.js
+++ b/jquery.lockfixed.min.js
@@ -6,8 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sun Jan 27 2013 12:00:00 GMT
+ * Date: Thue Dec 12 2013 12:00:00 GMT
*/
-(function(d){d.extend({lockfixed:function(a,b){b&&b.offset?(b.offset.bottom=parseInt(b.offset.bottom,10),b.offset.top=parseInt(b.offset.top,10)):b.offset={bottom:100,top:0};if((a=d(a))&&a.offset()){var h=a.offset().top;a.offset();a.outerHeight(!0);var j=a.outerWidth(),m=a.css("position"),n=a.css("top"),c=parseInt(a.css("marginTop"),10),k=d(document).height()-b.offset.bottom,f=0,g=!1;if(!0===b.forcemargin||navigator.userAgent.match(/\bMSIE (4|5|6)\./)||navigator.userAgent.match(/\bOS (3|4|5|6)_/)||
-navigator.userAgent.match(/\bAndroid (1|2|3|4)\./i))g=!0;d(window).bind("scroll resize orientationchange load",a,function(){var l=a.outerHeight(),e=d(window).scrollTop();if(!g||!(document.activeElement&&"INPUT"===document.activeElement.nodeName))e>=h-(c?c:0)-b.offset.top?(f=k=l-(c?c:0)-a.offset.top?(g=f
Date: Tue, 17 Dec 2013 12:03:00 +0100
Subject: [PATCH 02/17] push to jquery plugin
---
jquery.lockfixed.js | 2 +-
jquery.lockfixed.min.js | 2 +-
lockfixed.jquery.json | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index 69d9253..89fee2c 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -6,7 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Thue Dec 12 2013 12:00:00 GMT
+ * Date: Thue Dec 12 2013 12:00:01 GMT
*/
(function($, undefined){
$.extend({
diff --git a/jquery.lockfixed.min.js b/jquery.lockfixed.min.js
index 1d2ae52..ed2ee96 100644
--- a/jquery.lockfixed.min.js
+++ b/jquery.lockfixed.min.js
@@ -6,7 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Thue Dec 12 2013 12:00:00 GMT
+ * Date: Thue Dec 12 2013 12:00:01 GMT
*/
(function(d,q){d.extend({lockfixed:function(b,a){a&&a.offset?(a.offset.bottom=parseInt(a.offset.bottom,10),a.offset.top=parseInt(a.offset.top,10)):a.offset={bottom:100,top:0};if((b=d(b))&&b.offset()){var l=b.offset().top;b.outerHeight(!0);var m=b.outerWidth(),n=b.css("position"),p=b.css("top"),c=parseInt(b.css("marginTop"),10),f=d(document).height()-a.offset.bottom,g=0,h=!1;if(!0===a.forcemargin||navigator.userAgent.match(/\bMSIE (4|5|6)\./)||navigator.userAgent.match(/\bOS ([0-9])_/)||navigator.userAgent.match(/\bAndroid ([0-9])\./i))h=
!0;d(window).bind("scroll resize orientationchange load",b,function(k){k=b.outerHeight();var e=d(window).scrollTop();f=d(document).height()-a.offset.bottom;h&&document.activeElement&&"INPUT"===document.activeElement.nodeName||(e>=l-(c?c:0)-a.offset.top?(g=f
Date: Sat, 4 Jan 2014 13:29:15 +0100
Subject: [PATCH 03/17] optional update event when page height changes
call this event trigger to update to new height:
$(document).trigger('lockfixed:pageupdate');
---
jquery.lockfixed.js | 12 ++++++------
jquery.lockfixed.min.js | 6 +++---
lockfixed.jquery.json | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index 89fee2c..ff237d3 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -6,7 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Thue Dec 12 2013 12:00:01 GMT
+ * Date: Sat Jan 4 2014 12:00:01 GMT
*/
(function($, undefined){
$.extend({
@@ -25,7 +25,7 @@
var el =$(el);
if(el && el.offset()){
var el_top = el.offset().top,
- el_height = el.outerHeight(true),
+ el_height = el.outerHeight(),
el_width = el.outerWidth(),
el_position = el.css("position"),
el_position_top = el.css("top"),
@@ -42,17 +42,17 @@
pos_not_fixed = true;
}
- $(window).bind('scroll resize orientationchange load',el,function(e){
+ $(window).bind('scroll resize orientationchange load lockfixed:pageupdate',el,function(e){
var el_height = el.outerHeight(),
scroll_top = $(window).scrollTop();
- // check height on load event (specifically) due to elements being hidden on DOM ready - is this case, the height value is incorrect)
+ //check height on load event (specifically) due to elements being hidden on DOM ready - is this case, the height value is incorrect)
max_height = $(document).height() - config.offset.bottom;
-
+
//if we have a input focus don't change this (for ios zoom and stuff)
if(pos_not_fixed && document.activeElement && document.activeElement.nodeName === "INPUT"){
return;
- }
+ }
if (scroll_top >= (el_top-(el_margin_top ? el_margin_top : 0)-config.offset.top)){
diff --git a/jquery.lockfixed.min.js b/jquery.lockfixed.min.js
index ed2ee96..8715abe 100644
--- a/jquery.lockfixed.min.js
+++ b/jquery.lockfixed.min.js
@@ -6,7 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Thue Dec 12 2013 12:00:01 GMT
+ * Date: Sat Jan 4 2014 12:00:01 GMT
*/
-(function(d,q){d.extend({lockfixed:function(b,a){a&&a.offset?(a.offset.bottom=parseInt(a.offset.bottom,10),a.offset.top=parseInt(a.offset.top,10)):a.offset={bottom:100,top:0};if((b=d(b))&&b.offset()){var l=b.offset().top;b.outerHeight(!0);var m=b.outerWidth(),n=b.css("position"),p=b.css("top"),c=parseInt(b.css("marginTop"),10),f=d(document).height()-a.offset.bottom,g=0,h=!1;if(!0===a.forcemargin||navigator.userAgent.match(/\bMSIE (4|5|6)\./)||navigator.userAgent.match(/\bOS ([0-9])_/)||navigator.userAgent.match(/\bAndroid ([0-9])\./i))h=
-!0;d(window).bind("scroll resize orientationchange load",b,function(k){k=b.outerHeight();var e=d(window).scrollTop();f=d(document).height()-a.offset.bottom;h&&document.activeElement&&"INPUT"===document.activeElement.nodeName||(e>=l-(c?c:0)-a.offset.top?(g=f=l-(c?c:0)-a.offset.top?(g=f
Date: Mon, 27 Jan 2014 16:54:53 +0100
Subject: [PATCH 04/17] better findable
---
README.md | 7 ++++++-
lockfixed.jquery.json | 9 +++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 17d3d8a..5bdef35 100644
--- a/README.md
+++ b/README.md
@@ -26,4 +26,9 @@ Just send either one of us a message on Twitter: @yvoschaap.
### License
-lockfixed is released under the MIT license. See the [license](http://www.directlyrics.com/code/lockfixed/license.txt) for details.
\ No newline at end of file
+lockfixed is released under the MIT license. See the [license](http://www.directlyrics.com/code/lockfixed/license.txt) for details.
+
+
+## Keywords for repository search:
+
+lockfixed, sticky, scroll, set, element
\ No newline at end of file
diff --git a/lockfixed.jquery.json b/lockfixed.jquery.json
index e5d2f32..a4179c3 100644
--- a/lockfixed.jquery.json
+++ b/lockfixed.jquery.json
@@ -6,16 +6,17 @@
"fixed",
"dom",
"ui",
- "scroll"
+ "scroll",
+ "lockfixed"
],
- "version": "0.7.5",
+ "version": "0.7.7",
"author": {
"name": "Yvo Schaap",
"url": "http://www.directlyrics.com/code/lockfixed/"
},
"maintainers": [
{
- "name": "Lyrics",
+ "name": "Directlyrics",
"email": "yvo@yvoschaap.com",
"url": "http://www.directlyrics.com/"
}
@@ -27,7 +28,7 @@
}
],
"homepage": "http://www.directlyrics.com/code/lockfixed/",
- "demp": "http://www.directlyrics.com/code/lockfixed/demo.html",
+ "demo": "http://www.directlyrics.com/code/lockfixed/demo.html",
"docs": "http://www.directlyrics.com/code/lockfixed/",
"dependencies": {
"jquery": ">=1.5"
From 5683ce86646ec40a9af25aaabf95be090a5b5595 Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Sun, 9 Feb 2014 15:53:20 +0100
Subject: [PATCH 05/17] jumpy scroll bug resolved
A jumpy element on scrolling in certain cases is resolved, thanks to
https://t.co/axuA2JLok0
---
jquery.lockfixed.js | 47 +++++++++++++++++++++++------------------
jquery.lockfixed.min.js | 7 +++---
lockfixed.jquery.json | 2 +-
3 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index ff237d3..4510172 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -6,7 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sat Jan 4 2014 12:00:01 GMT
+ * Date: Sat Feb 8 2014 12:00:01 GMT
*/
(function($, undefined){
$.extend({
@@ -24,36 +24,41 @@
}
var el =$(el);
if(el && el.offset()){
- var el_top = el.offset().top,
- el_height = el.outerHeight(),
- el_width = el.outerWidth(),
- el_position = el.css("position"),
- el_position_top = el.css("top"),
- el_margin_top = parseInt(el.css("marginTop"),10),
- max_height = $(document).height() - config.offset.bottom,
- top = 0,
- swtch = false,
- pos_not_fixed = false;
+ var el_position = el.css("position"),
+ el_margin_top = parseInt(el.css("marginTop"),10),
+ el_position_top = el.css("top"),
+ el_top = el.offset().top,
+ pos_not_fixed = false;
- /* we prefer feature testing, too much hassle for the upside */
- /* while prettier to use position: fixed (less jitter when scrolling) */
- /* iOS 5+ + Android has fixed support, but issue with toggeling between fixed and not and zoomed view */
+ /*
+ * We prefer feature testing, too much hassle for the upside
+ * while prettier to use position: fixed (less jitter when scrolling)
+ * iOS 5+ + Android has fixed support, but issue with toggeling between fixed and not and zoomed view
+ */
if (config.forcemargin === true || navigator.userAgent.match(/\bMSIE (4|5|6)\./) || navigator.userAgent.match(/\bOS ([0-9])_/) || navigator.userAgent.match(/\bAndroid ([0-9])\./i)){
pos_not_fixed = true;
}
$(window).bind('scroll resize orientationchange load lockfixed:pageupdate',el,function(e){
- var el_height = el.outerHeight(),
- scroll_top = $(window).scrollTop();
-
- //check height on load event (specifically) due to elements being hidden on DOM ready - is this case, the height value is incorrect)
- max_height = $(document).height() - config.offset.bottom;
-
- //if we have a input focus don't change this (for ios zoom and stuff)
+
+ // if we have a input focus don't change this (for ios zoom and stuff)
if(pos_not_fixed && document.activeElement && document.activeElement.nodeName === "INPUT"){
return;
}
+ var top = 0,
+ el_height = el.outerHeight(),
+ el_width = el.outerWidth(),
+ max_height = $(document).height() - config.offset.bottom,
+ scroll_top = $(window).scrollTop();
+
+ // if element is not currently fixed position, reset measurements ( this handles DOM changes in dynamic pages )
+ if (el.css("position") != "fixed") {
+ el_top = el.offset().top;
+ el_margin_top = parseInt(el.css("marginTop"),10);
+ el_position_top = el.css("top");
+ }
+
if (scroll_top >= (el_top-(el_margin_top ? el_margin_top : 0)-config.offset.top)){
if(max_height < (scroll_top + el_height + el_margin_top + config.offset.top)){
diff --git a/jquery.lockfixed.min.js b/jquery.lockfixed.min.js
index 8715abe..864193e 100644
--- a/jquery.lockfixed.min.js
+++ b/jquery.lockfixed.min.js
@@ -6,7 +6,8 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sat Jan 4 2014 12:00:01 GMT
+ * Date: Sat Feb 8 2014 12:00:01 GMT
*/
-(function(d,q){d.extend({lockfixed:function(b,a){a&&a.offset?(a.offset.bottom=parseInt(a.offset.bottom,10),a.offset.top=parseInt(a.offset.top,10)):a.offset={bottom:100,top:0};if((b=d(b))&&b.offset()){var l=b.offset().top;b.outerHeight();var m=b.outerWidth(),n=b.css("position"),p=b.css("top"),c=parseInt(b.css("marginTop"),10),f=d(document).height()-a.offset.bottom,g=0,h=!1;if(!0===a.forcemargin||navigator.userAgent.match(/\bMSIE (4|5|6)\./)||navigator.userAgent.match(/\bOS ([0-9])_/)||navigator.userAgent.match(/\bAndroid ([0-9])\./i))h=
-!0;d(window).bind("scroll resize orientationchange load lockfixed:pageupdate",b,function(k){k=b.outerHeight();var e=d(window).scrollTop();f=d(document).height()-a.offset.bottom;h&&document.activeElement&&"INPUT"===document.activeElement.nodeName||(e>=l-(c?c:0)-a.offset.top?(g=f=g-(c?c:0)-b.offset.top?(d=m
Date: Sun, 9 Feb 2014 21:14:18 +0100
Subject: [PATCH 06/17] some tweaks for fallback margin offset
---
jquery.lockfixed.js | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index 4510172..20f2c3f 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -6,7 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sat Feb 8 2014 12:00:01 GMT
+ * Date: Sun Feb 9 2014 12:00:01 GMT
*/
(function($, undefined){
$.extend({
@@ -22,7 +22,7 @@
}else{
config.offset = {bottom: 100, top: 0};
}
- var el =$(el);
+ var el = $(el);
if(el && el.offset()){
var el_position = el.css("position"),
el_margin_top = parseInt(el.css("marginTop"),10),
@@ -38,10 +38,19 @@
if (config.forcemargin === true || navigator.userAgent.match(/\bMSIE (4|5|6)\./) || navigator.userAgent.match(/\bOS ([0-9])_/) || navigator.userAgent.match(/\bAndroid ([0-9])\./i)){
pos_not_fixed = true;
}
-
+
+ /*
+ // adds throttle to position calc; modern browsers should handle resize event fine
$(window).bind('scroll resize orientationchange load lockfixed:pageupdate',el,function(e){
- // if we have a input focus don't change this (for ios zoom and stuff)
+ window.setTimeout(function(){
+ $(document).trigger('lockfixed:pageupdate:async');
+ });
+ });
+ */
+
+ $(window).bind('scroll resize orientationchange load lockfixed:pageupdate',el,function(e){
+ // if we have a input focus don't change this (for smaller screens)
if(pos_not_fixed && document.activeElement && document.activeElement.nodeName === "INPUT"){
return;
}
@@ -53,7 +62,7 @@
scroll_top = $(window).scrollTop();
// if element is not currently fixed position, reset measurements ( this handles DOM changes in dynamic pages )
- if (el.css("position") != "fixed") {
+ if (el.css("position") !== "fixed") {
el_top = el.offset().top;
el_margin_top = parseInt(el.css("marginTop"),10);
el_position_top = el.css("top");
@@ -73,7 +82,7 @@
el.css({'position': 'fixed','top':(config.offset.top-top)+'px','width':el_width +"px"});
}
}else{
- el.css({'position': el_position,'top': el_position_top, 'width':el_width +"px", 'marginTop': (el_margin_top ? el_margin_top : 0)+"px"});
+ el.css({'position': el_position,'top': el_position_top, 'width':el_width +"px", 'marginTop': (el_margin_top && !pos_not_fixed ? el_margin_top : 0)+"px"});
}
});
}
From a80293e9dbaabe4f9dcc38cdda193c604fded34a Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Mon, 10 Feb 2014 12:08:10 +0100
Subject: [PATCH 07/17] extra tweaks to margin offset fallback
---
jquery.lockfixed.js | 13 ++++++-------
jquery.lockfixed.min.js | 8 ++++----
lockfixed.jquery.json | 2 +-
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index 20f2c3f..babc9ca 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -40,12 +40,12 @@
}
/*
- // adds throttle to position calc; modern browsers should handle resize event fine
- $(window).bind('scroll resize orientationchange load lockfixed:pageupdate',el,function(e){
+ // adds throttle to scroll call
+ $(window).bind('scroll',el,function(e){
window.setTimeout(function(){
- $(document).trigger('lockfixed:pageupdate:async');
- });
+ $(document).trigger('lockfixed:pageupdate');
+ },25);
});
*/
@@ -62,9 +62,8 @@
scroll_top = $(window).scrollTop();
// if element is not currently fixed position, reset measurements ( this handles DOM changes in dynamic pages )
- if (el.css("position") !== "fixed") {
+ if (el.css("position") !== "fixed" && !pos_not_fixed) {
el_top = el.offset().top;
- el_margin_top = parseInt(el.css("marginTop"),10);
el_position_top = el.css("top");
}
@@ -77,7 +76,7 @@
}
if (pos_not_fixed){
- el.css({'marginTop': parseInt(((el_margin_top ? el_margin_top : 0) + (scroll_top - el_top - top) + 2 * config.offset.top),10)+'px'});
+ el.css({'marginTop': (parseInt(scroll_top - el_top - top,10) + (2 * config.offset.top))+'px'});
}else{
el.css({'position': 'fixed','top':(config.offset.top-top)+'px','width':el_width +"px"});
}
diff --git a/jquery.lockfixed.min.js b/jquery.lockfixed.min.js
index 864193e..dc89c5a 100644
--- a/jquery.lockfixed.min.js
+++ b/jquery.lockfixed.min.js
@@ -6,8 +6,8 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sat Feb 8 2014 12:00:01 GMT
+ * Date: Sun Feb 9 2014 12:00:01 GMT
*/
-(function(e,p){e.extend({lockfixed:function(a,b){b&&b.offset?(b.offset.bottom=parseInt(b.offset.bottom,10),b.offset.top=parseInt(b.offset.top,10)):b.offset={bottom:100,top:0};if((a=e(a))&&a.offset()){var n=a.css("position"),c=parseInt(a.css("marginTop"),10),l=a.css("top"),g=a.offset().top,h=!1;if(!0===b.forcemargin||navigator.userAgent.match(/\bMSIE (4|5|6)\./)||navigator.userAgent.match(/\bOS ([0-9])_/)||navigator.userAgent.match(/\bAndroid ([0-9])\./i))h=!0;e(window).bind("scroll resize orientationchange load lockfixed:pageupdate",
-a,function(k){if(!h||!document.activeElement||"INPUT"!==document.activeElement.nodeName){var d=0,d=a.outerHeight();k=a.outerWidth();var m=e(document).height()-b.offset.bottom,f=e(window).scrollTop();"fixed"!=a.css("position")&&(g=a.offset().top,c=parseInt(a.css("marginTop"),10),l=a.css("top"));f>=g-(c?c:0)-b.offset.top?(d=m=h-(c?c:0)-b.offset.top?(d=m
Date: Mon, 28 Apr 2014 18:15:02 +0200
Subject: [PATCH 08/17] doc contact update
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 5bdef35..9f8fbc1 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Find the [documentation](http://www.directlyrics.com/code/lockfixed/).
### Problems?
-Just send either one of us a message on Twitter: @yvoschaap.
+Just send me a message via @yvoschaap or yvo@yvoschaap.com.
### License
@@ -31,4 +31,4 @@ lockfixed is released under the MIT license. See the [license](http://www.direc
## Keywords for repository search:
-lockfixed, sticky, scroll, set, element
\ No newline at end of file
+lockfixed, sticky, scroll, set, element, lock, fixed, lock fixed
\ No newline at end of file
From ac4db9493437518b7b929f54566bb3aaeb87f02b Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Mon, 28 Apr 2014 18:17:12 +0200
Subject: [PATCH 09/17] small doc edit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 9f8fbc1..cb587e9 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Find the [documentation](http://www.directlyrics.com/code/lockfixed/).
### Problems?
-Just send me a message via @yvoschaap or yvo@yvoschaap.com.
+Just send me a message via @yvoschaap or yvo [@] yvoschaap.com.
### License
From 6aabb24a536ec20b1f79256b23845e5787f4b815 Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Mon, 28 Apr 2014 18:19:56 +0200
Subject: [PATCH 10/17] micro update
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index cb587e9..ac9540a 100644
--- a/README.md
+++ b/README.md
@@ -31,4 +31,4 @@ lockfixed is released under the MIT license. See the [license](http://www.direc
## Keywords for repository search:
-lockfixed, sticky, scroll, set, element, lock, fixed, lock fixed
\ No newline at end of file
+lockfixed, sticky, scroll, set, element, lock, fixed, lock fixed
From 95b4d58af9898da99829da3bd1b03cc884677601 Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Mon, 28 Apr 2014 18:26:09 +0200
Subject: [PATCH 11/17] micro update #2
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index ac9540a..76e7320 100644
--- a/README.md
+++ b/README.md
@@ -32,3 +32,4 @@ lockfixed is released under the MIT license. See the [license](http://www.direc
## Keywords for repository search:
lockfixed, sticky, scroll, set, element, lock, fixed, lock fixed
+
From 0b70c07d9982ec8ec25d8e51a42a0868ddf0a359 Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Wed, 7 May 2014 16:01:50 +0200
Subject: [PATCH 12/17] quicker responsive
By listening to DOMContentLoaded also.
---
jquery.lockfixed.js | 4 ++--
jquery.lockfixed.min.js | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index babc9ca..04eb963 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -6,7 +6,7 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sun Feb 9 2014 12:00:01 GMT
+ * Date: Sun March 4 2014 12:00:01 GMT
*/
(function($, undefined){
$.extend({
@@ -49,7 +49,7 @@
});
*/
- $(window).bind('scroll resize orientationchange load lockfixed:pageupdate',el,function(e){
+ $(window).bind('DOMContentLoaded load scroll resize orientationchange lockfixed:pageupdate',el,function(e){
// if we have a input focus don't change this (for smaller screens)
if(pos_not_fixed && document.activeElement && document.activeElement.nodeName === "INPUT"){
return;
diff --git a/jquery.lockfixed.min.js b/jquery.lockfixed.min.js
index dc89c5a..0736814 100644
--- a/jquery.lockfixed.min.js
+++ b/jquery.lockfixed.min.js
@@ -6,8 +6,8 @@
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sun Feb 9 2014 12:00:01 GMT
+ * Date: Sun March 4 2014 12:00:01 GMT
*/
-(function(e,p){e.extend({lockfixed:function(a,b){b&&b.offset?(b.offset.bottom=parseInt(b.offset.bottom,10),b.offset.top=parseInt(b.offset.top,10)):b.offset={bottom:100,top:0};if((a=e(a))&&a.offset()){var n=a.css("position"),c=parseInt(a.css("marginTop"),10),l=a.css("top"),h=a.offset().top,f=!1;if(!0===b.forcemargin||navigator.userAgent.match(/\bMSIE (4|5|6)\./)||navigator.userAgent.match(/\bOS ([0-9])_/)||navigator.userAgent.match(/\bAndroid ([0-9])\./i))f=!0;e(window).bind("scroll resize orientationchange load lockfixed:pageupdate",
+(function(e,p){e.extend({lockfixed:function(a,b){b&&b.offset?(b.offset.bottom=parseInt(b.offset.bottom,10),b.offset.top=parseInt(b.offset.top,10)):b.offset={bottom:100,top:0};if((a=e(a))&&a.offset()){var n=a.css("position"),c=parseInt(a.css("marginTop"),10),l=a.css("top"),h=a.offset().top,f=!1;if(!0===b.forcemargin||navigator.userAgent.match(/\bMSIE (4|5|6)\./)||navigator.userAgent.match(/\bOS ([0-9])_/)||navigator.userAgent.match(/\bAndroid ([0-9])\./i))f=!0;e(window).bind("DOMContentLoaded load scroll resize orientationchange lockfixed:pageupdate",
a,function(k){if(!f||!document.activeElement||"INPUT"!==document.activeElement.nodeName){var d=0,d=a.outerHeight();k=a.outerWidth();var m=e(document).height()-b.offset.bottom,g=e(window).scrollTop();"fixed"===a.css("position")||f||(h=a.offset().top,l=a.css("top"));g>=h-(c?c:0)-b.offset.top?(d=m
Date: Wed, 7 May 2014 16:06:44 +0200
Subject: [PATCH 13/17] version update for jquery repository
---
lockfixed.jquery.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lockfixed.jquery.json b/lockfixed.jquery.json
index e9a3d9e..46a9a3e 100644
--- a/lockfixed.jquery.json
+++ b/lockfixed.jquery.json
@@ -9,7 +9,7 @@
"scroll",
"lockfixed"
],
- "version": "0.8.1",
+ "version": "0.8.4",
"author": {
"name": "Yvo Schaap",
"url": "http://www.directlyrics.com/code/lockfixed/"
From 2c204a04c6a1c24f9414b09eed56b3ae0c15b36d Mon Sep 17 00:00:00 2001
From: Jonas Aschenbrenner
Date: Thu, 16 Oct 2014 15:39:06 +0200
Subject: [PATCH 14/17] Fixes two bugs
Fixes the following cases:
* Element has no margin top
* Fixed element height is less then window height
---
jquery.lockfixed.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index 04eb963..1618c9e 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -25,7 +25,7 @@
var el = $(el);
if(el && el.offset()){
var el_position = el.css("position"),
- el_margin_top = parseInt(el.css("marginTop"),10),
+ el_margin_top = parseInt(el.css("marginTop"),10) || 0,
el_position_top = el.css("top"),
el_top = el.offset().top,
pos_not_fixed = false;
@@ -69,7 +69,10 @@
if (scroll_top >= (el_top-(el_margin_top ? el_margin_top : 0)-config.offset.top)){
- if(max_height < (scroll_top + el_height + el_margin_top + config.offset.top)){
+ if(
+ max_height < (scroll_top + el_height + el_margin_top + config.offset.top) &&
+ el_height + config.offset.top > $(window).height()
+ ){
top = (scroll_top + el_height + el_margin_top + config.offset.top) - max_height;
}else{
top = 0;
@@ -87,4 +90,4 @@
}
}
});
-})(jQuery);
\ No newline at end of file
+})(jQuery);
From e111a1f7fa9fcaff5e97ececdbecc2c06cc45868 Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Mon, 17 Nov 2014 12:16:37 +0100
Subject: [PATCH 15/17] Move to npm: lockfixed
Moving away from plugins.jquery.com to npmjs.org.
Now available with npm: lockfixed
---
.npmignore | 2 ++
package.json | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
create mode 100644 .npmignore
create mode 100644 package.json
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..d004a9a
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,2 @@
+/node_modules/
+.DS_Store
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..2e23902
--- /dev/null
+++ b/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "lockfixed",
+ "title": "jQuery Lock Fixed",
+ "description": "jQuery plugin which allows for DOM elements to be positioned anywhere on the page, and lock within the user's viewport when scrolling. Common use case is a menu under a header, which on scrolling stays fixed within the viewport.",
+ "keywords": [
+ "jquery-plugin",
+ "fixed",
+ "dom",
+ "ui",
+ "scroll",
+ "lockfixed",
+ "lock fixed",
+ "sticky"
+ ],
+ "version": "0.8.4",
+ "author": {
+ "name": "Yvo Schaap",
+ "url": "http://www.directlyrics.com/code/lockfixed/"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://www.directlyrics.com/code/lockfixed/license.txt"
+ }
+ ],
+ "homepage": "http://www.directlyrics.com/code/lockfixed/",
+ "demo": "http://www.directlyrics.com/code/lockfixed/demo.html",
+ "docs": "http://www.directlyrics.com/code/lockfixed/",
+ "dependencies": {
+ "jquery": ">=1.5"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/ymschaap/jquery-lockfixed"
+ },
+ "bugs": {
+ "url": "https://github.com/ymschaap/jquery-lockfixed/issues"
+ }
+}
\ No newline at end of file
From 7892e6a3e96848c1393a6403d1b4b855c2d80b31 Mon Sep 17 00:00:00 2001
From: Yvo Schaap
Date: Mon, 30 Mar 2015 16:35:33 +0200
Subject: [PATCH 16/17] Wraps lockfixed element
Adds a wrapper div around the lockfixed element to catch issues with
toggling between position: fixed.
---
jquery.lockfixed.js | 155 +++++++++++++++++++++-------------------
jquery.lockfixed.min.js | 10 +--
2 files changed, 86 insertions(+), 79 deletions(-)
diff --git a/jquery.lockfixed.js b/jquery.lockfixed.js
index 04eb963..3c904d9 100644
--- a/jquery.lockfixed.js
+++ b/jquery.lockfixed.js
@@ -2,89 +2,96 @@
* jQuery lockfixed plugin
* http://www.directlyrics.com/code/lockfixed/
*
- * Copyright 2012 Yvo Schaap
+ * Copyright 2012-2015 Yvo Schaap
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sun March 4 2014 12:00:01 GMT
+ * Date: Sun March 30 2015 12:00:01 GMT
*/
-(function($, undefined){
- $.extend({
- /**
- * Lockfixed initiated
- * @param {Element} el - a jquery element, DOM node or selector string
- * @param {Object} config - offset - forcemargin
- */
- "lockfixed": function(el, config){
- if (config && config.offset) {
- config.offset.bottom = parseInt(config.offset.bottom,10);
- config.offset.top = parseInt(config.offset.top,10);
- }else{
- config.offset = {bottom: 100, top: 0};
- }
- var el = $(el);
- if(el && el.offset()){
- var el_position = el.css("position"),
- el_margin_top = parseInt(el.css("marginTop"),10),
- el_position_top = el.css("top"),
- el_top = el.offset().top,
- pos_not_fixed = false;
-
- /*
- * We prefer feature testing, too much hassle for the upside
- * while prettier to use position: fixed (less jitter when scrolling)
- * iOS 5+ + Android has fixed support, but issue with toggeling between fixed and not and zoomed view
- */
- if (config.forcemargin === true || navigator.userAgent.match(/\bMSIE (4|5|6)\./) || navigator.userAgent.match(/\bOS ([0-9])_/) || navigator.userAgent.match(/\bAndroid ([0-9])\./i)){
- pos_not_fixed = true;
- }
+(function($, undefined) {
+ $.extend({
+ /**
+ * Lockfixed initiated
+ * @param {Element} el - a jquery element, DOM node or selector string
+ * @param {Object} config - offset - forcemargin
+ */
+ "lockfixed": function(el, config) {
+ if (config && config.offset) {
+ config.offset.bottom = parseInt(config.offset.bottom, 10);
+ config.offset.top = parseInt(config.offset.top, 10);
+ } else {
+ config.offset = {
+ bottom: 100,
+ top: 0
+ };
+ }
+ var el = $(el);
+ if (el && el.offset()) {
+ var el_position = el.css("position"),
+ el_margin_top = parseInt(el.css("marginTop"), 10),
+ el_position_top = el.css("top"),
+ el_top = el.offset().top,
+ pos_not_fixed = false;
- /*
- // adds throttle to scroll call
- $(window).bind('scroll',el,function(e){
+ //We prefer feature testing, too much hassle for the upside
+ //while prettier to use position: fixed (less jitter when scrolling)
+ //iOS 5+ && Android does has fixed support, but results in issue with toggeling between fixed and viewport zoom
- window.setTimeout(function(){
- $(document).trigger('lockfixed:pageupdate');
- },25);
- });
- */
+ if (config.forcemargin === true || navigator.userAgent.match(/\bMSIE (4|5|6)\./) || navigator.userAgent.match(/\bOS ([0-9])_/) || navigator.userAgent.match(/\bAndroid ([0-9])\./i)) {
+ pos_not_fixed = true;
+ }
- $(window).bind('DOMContentLoaded load scroll resize orientationchange lockfixed:pageupdate',el,function(e){
- // if we have a input focus don't change this (for smaller screens)
- if(pos_not_fixed && document.activeElement && document.activeElement.nodeName === "INPUT"){
- return;
- }
+ // We wrap the element with the height of the lockfixed, because position: fixed removes the height leaving an empty area (and some jitter)
+ el.wrap("");
- var top = 0,
- el_height = el.outerHeight(),
- el_width = el.outerWidth(),
- max_height = $(document).height() - config.offset.bottom,
- scroll_top = $(window).scrollTop();
-
- // if element is not currently fixed position, reset measurements ( this handles DOM changes in dynamic pages )
- if (el.css("position") !== "fixed" && !pos_not_fixed) {
- el_top = el.offset().top;
- el_position_top = el.css("top");
- }
+ // Bind to most comment events that will need to recalculate our lockfixed position
+ $(window).bind('DOMContentLoaded load scroll resize orientationchange lockfixed:pageupdate', el, function(e) {
+ // if we have a input focus don't change this (for smaller screens)
+ if (pos_not_fixed && document.activeElement && document.activeElement.nodeName === "INPUT") {
+ return;
+ }
- if (scroll_top >= (el_top-(el_margin_top ? el_margin_top : 0)-config.offset.top)){
+ var top = 0,
+ el_height = el.outerHeight(),
+ el_width = el.outerWidth(),
+ max_height = $(document).height() - config.offset.bottom,
+ scroll_top = $(window).scrollTop();
- if(max_height < (scroll_top + el_height + el_margin_top + config.offset.top)){
- top = (scroll_top + el_height + el_margin_top + config.offset.top) - max_height;
- }else{
- top = 0;
- }
+ // if element is not currently fixed position, reset measurements ( this handles DOM changes in dynamic pages )
+ if (el.css("position") !== "fixed" && !pos_not_fixed) {
+ el_top = el.offset().top;
+ el_position_top = el.css("top");
+ }
- if (pos_not_fixed){
- el.css({'marginTop': (parseInt(scroll_top - el_top - top,10) + (2 * config.offset.top))+'px'});
- }else{
- el.css({'position': 'fixed','top':(config.offset.top-top)+'px','width':el_width +"px"});
- }
- }else{
- el.css({'position': el_position,'top': el_position_top, 'width':el_width +"px", 'marginTop': (el_margin_top && !pos_not_fixed ? el_margin_top : 0)+"px"});
- }
- });
- }
- }
- });
+ if (scroll_top >= (el_top - (el_margin_top ? el_margin_top : 0) - config.offset.top)) {
+
+ if (max_height < (scroll_top + el_height + el_margin_top + config.offset.top)) {
+ top = (scroll_top + el_height + el_margin_top + config.offset.top) - max_height;
+ } else {
+ top = 0;
+ }
+
+ if (pos_not_fixed) {
+ el.css({
+ 'marginTop': (parseInt(scroll_top - el_top - top, 10) + (2 * config.offset.top)) + 'px'
+ });
+ } else {
+ el.css({
+ 'position': 'fixed',
+ 'top': (config.offset.top - top) + 'px',
+ 'width': el_width + "px"
+ });
+ }
+ } else {
+ el.css({
+ 'position': el_position,
+ 'top': el_position_top,
+ 'width': el_width + "px",
+ 'marginTop': (el_margin_top && !pos_not_fixed ? el_margin_top : 0) + "px"
+ });
+ }
+ });
+ }
+ }
+ });
})(jQuery);
\ No newline at end of file
diff --git a/jquery.lockfixed.min.js b/jquery.lockfixed.min.js
index 0736814..4548f7c 100644
--- a/jquery.lockfixed.min.js
+++ b/jquery.lockfixed.min.js
@@ -2,12 +2,12 @@
* jQuery lockfixed plugin
* http://www.directlyrics.com/code/lockfixed/
*
- * Copyright 2012 Yvo Schaap
+ * Copyright 2012-2015 Yvo Schaap
* Released under the MIT license
* http://www.directlyrics.com/code/lockfixed/license.txt
*
- * Date: Sun March 4 2014 12:00:01 GMT
+ * Date: Sun March 30 2015 12:00:01 GMT
*/
-(function(e,p){e.extend({lockfixed:function(a,b){b&&b.offset?(b.offset.bottom=parseInt(b.offset.bottom,10),b.offset.top=parseInt(b.offset.top,10)):b.offset={bottom:100,top:0};if((a=e(a))&&a.offset()){var n=a.css("position"),c=parseInt(a.css("marginTop"),10),l=a.css("top"),h=a.offset().top,f=!1;if(!0===b.forcemargin||navigator.userAgent.match(/\bMSIE (4|5|6)\./)||navigator.userAgent.match(/\bOS ([0-9])_/)||navigator.userAgent.match(/\bAndroid ([0-9])\./i))f=!0;e(window).bind("DOMContentLoaded load scroll resize orientationchange lockfixed:pageupdate",
-a,function(k){if(!f||!document.activeElement||"INPUT"!==document.activeElement.nodeName){var d=0,d=a.outerHeight();k=a.outerWidth();var m=e(document).height()-b.offset.bottom,g=e(window).scrollTop();"fixed"===a.css("position")||f||(h=a.offset().top,l=a.css("top"));g>=h-(c?c:0)-b.offset.top?(d=m");e(window).bind("DOMContentLoaded load scroll resize orientationchange lockfixed:pageupdate",a,function(k){if(!f||!document.activeElement||"INPUT"!==document.activeElement.nodeName){var d=0,d=a.outerHeight();k=a.outerWidth();var m=e(document).height()-b.offset.bottom,g=e(window).scrollTop();"fixed"===a.css("position")||f||(h=a.offset().top,l=a.css("top"));g>=h-(c?c:0)-b.offset.top?(d=m
Date: Mon, 30 Mar 2015 16:43:31 +0200
Subject: [PATCH 17/17] Version bump
---
package.json | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 2e23902..0f15739 100644
--- a/package.json
+++ b/package.json
@@ -10,9 +10,10 @@
"scroll",
"lockfixed",
"lock fixed",
- "sticky"
+ "sticky",
+ "jquery"
],
- "version": "0.8.4",
+ "version": "0.9.0",
"author": {
"name": "Yvo Schaap",
"url": "http://www.directlyrics.com/code/lockfixed/"