Sticky Menu (or Anything!) on Scroll - Version 1.3.1

Version Description

  • Minor bug fix for push-up element
Download this release

Release Info

Developer senff
Plugin Icon 128x128 Sticky Menu (or Anything!) on Scroll
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3 to 1.3.1

README.md CHANGED
@@ -1,11 +1,11 @@
1
  # Sticky Menu (or Anything!) on Scroll
2
  * Contributors: senff
3
  * Donate link: http://www.senff.com/donate
4
- * Tags: plugin, sticky, menu, scroll, element
5
  * Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
6
  * Requires at least: 3.6
7
- * Tested up to: 4.2.2
8
- * Stable tag: 1.3
9
  * License: GPLv2 or later
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -94,6 +94,9 @@ The plugin's own page can be found [here](http://www.senff.com/plugins/sticky-an
94
 
95
  ## Changelog
96
 
 
 
 
97
  ### 1.3
98
  * Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
99
  * Added functionality to push sticky element up by another element lower down the page
@@ -134,6 +137,9 @@ The plugin's own page can be found [here](http://www.senff.com/plugins/sticky-an
134
 
135
  ## Upgrade Notice
136
 
 
 
 
137
  ### 1.3
138
  * BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
139
 
1
  # Sticky Menu (or Anything!) on Scroll
2
  * Contributors: senff
3
  * Donate link: http://www.senff.com/donate
4
+ * Tags: sticky header, sticky menu, sticky, header, menu
5
  * Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
6
  * Requires at least: 3.6
7
+ * Tested up to: 4.5
8
+ * Stable tag: 1.3.1
9
  * License: GPLv2 or later
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
94
 
95
  ## Changelog
96
 
97
+ ### 1.3.1
98
+ * Minor bug fix for push-up element
99
+
100
  ### 1.3
101
  * Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
102
  * Added functionality to push sticky element up by another element lower down the page
137
 
138
  ## Upgrade Notice
139
 
140
+ ### 1.3.1
141
+ * Minor bug fix for push-up element
142
+
143
  ### 1.3
144
  * BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
145
 
assets/js/jq-sticky-anything.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * @preserve Sticky Anything 1.3 | @senff | GPL2 Licensed
3
  */
4
 
5
  (function ($) {
@@ -103,7 +103,7 @@
103
  leftOrgElement = coordsOrgElement.left;
104
  widthOrgElement = orgElement.css('width');
105
  heightOrgElement = orgElement.outerHeight();
106
-
107
  // If padding is percentages, convert to pixels
108
  paddingOrgElement = [orgElement.css('padding-top'), orgElement.css('padding-right'), orgElement.css('padding-bottom'), orgElement.css('padding-left')];
109
  paddingCloned = paddingOrgElement[0] + ' ' + paddingOrgElement[1] + ' ' + paddingOrgElement[2] + ' ' + paddingOrgElement[3];
@@ -113,8 +113,18 @@
113
  createClone(stickyTop,stickyZindex);
114
  }
115
 
116
- if (pushup && ($(window).scrollTop() > (pushElementTop-heightOrgElement-adminBarHeight))) {
117
- stickyTopMargin = (pushElementTop-heightOrgElement-$(window).scrollTop());
 
 
 
 
 
 
 
 
 
 
118
  } else {
119
  stickyTopMargin = adminBarHeight;
120
  }
1
  /**
2
+ * @preserve Sticky Anything 1.3.1 | @senff | GPL2 Licensed
3
  */
4
 
5
  (function ($) {
103
  leftOrgElement = coordsOrgElement.left;
104
  widthOrgElement = orgElement.css('width');
105
  heightOrgElement = orgElement.outerHeight();
106
+
107
  // If padding is percentages, convert to pixels
108
  paddingOrgElement = [orgElement.css('padding-top'), orgElement.css('padding-right'), orgElement.css('padding-bottom'), orgElement.css('padding-left')];
109
  paddingCloned = paddingOrgElement[0] + ' ' + paddingOrgElement[1] + ' ' + paddingOrgElement[2] + ' ' + paddingOrgElement[3];
113
  createClone(stickyTop,stickyZindex);
114
  }
115
 
116
+ // Fixes bug where height of original element returns zero
117
+ elementHeight = 0;
118
+ if (heightOrgElement < 1) {
119
+ elementHeight = $('.cloned').outerHeight();
120
+ } else {
121
+ elementHeight = $('.original').outerHeight();
122
+ }
123
+
124
+ // If scrolled position = pushup-element (top coordinate) - space between top and element - element height - admin bar
125
+ // In other words, if the pushup element hits the bottom of the sticky element
126
+ if (pushup && ($(window).scrollTop() > (pushElementTop-stickyTop-elementHeight-adminBarHeight))) {
127
+ stickyTopMargin = (pushElementTop-stickyTop-elementHeight-$(window).scrollTop());
128
  } else {
129
  stickyTopMargin = adminBarHeight;
130
  }
assets/js/jq-sticky-anything.min.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * @preserve Sticky Anything 1.3 | @senff | GPL2 Licensed
3
  */
4
 
5
- !function(e){function t(t,o,i,s,r,l,d){var c=e(".original").offset();if(orgElementTop=c.top,r){var m=e(r).offset();pushElementTop=m.top}var a=window,h="inner";"innerWidth"in window||(h="client",a=document.documentElement||document.body),viewport=a[h+"Width"],adminBarHeight=d&&e("body").hasClass("admin-bar")&&viewport>600?e("#wpadminbar").height():0,e(window).scrollTop()>=orgElementTop-t-adminBarHeight&&viewport>=o&&viewport<=i?(orgElement=e(".original"),coordsOrgElement=orgElement.offset(),leftOrgElement=coordsOrgElement.left,widthOrgElement=orgElement.css("width"),heightOrgElement=orgElement.outerHeight(),paddingOrgElement=[orgElement.css("padding-top"),orgElement.css("padding-right"),orgElement.css("padding-bottom"),orgElement.css("padding-left")],paddingCloned=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3],1==l&&e(".cloned").length<1&&n(t,s),stickyTopMargin=r&&e(window).scrollTop()>pushElementTop-heightOrgElement-adminBarHeight?pushElementTop-heightOrgElement-e(window).scrollTop():adminBarHeight,e(".cloned").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthOrgElement).css("margin-top",stickyTopMargin).css("padding",paddingCloned).show(),e(".original").css("visibility","hidden")):(1==l?e(".cloned").remove():e(".cloned").hide(),e(".original").css("visibility","visible"))}function n(t,n){e(".original").clone().insertAfter(e(".original")).addClass("cloned").css("position","fixed").css("top",t+"px").css("margin-left","0").css("z-index",n).removeClass("original").hide()}e.fn.stickThis=function(o){var i=e.extend({top:0,minscreenwidth:0,maxscreenwidth:99999,zindex:1,dynamicmode:!1,debugmode:!1,pushup:"",adminbar:!1},o),s=e(this).length,r=e(i.pushup).length;return 1>r?(1==i.debugmode&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the Push-up element ("'+i.pushup+'").'),i.pushup=""):r>1&&(1==i.debugmode&&console.error("STICKY ANYTHING DEBUG: There are "+r+' elements on the page with the selector/class/ID you selected for the push-up element ("'+i.pushup+'"). You can select only ONE element to push the sticky element up.'),i.pushup=""),1>s?1==i.debugmode&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'").'):s>1?1==i.debugmode&&console.error("STICKY ANYTHING DEBUG: There There are "+r+' elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'"). You can only make ONE element sticky.'):(e(this).addClass("original"),1!=i.dynamicmode&&n(i.top,i.zindex,i.adminbar),checkElement=setInterval(function(){t(i.top,i.minscreenwidth,i.maxscreenwidth,i.zindex,i.pushup,i.dynamicmode,i.adminbar)},10)),this}}(jQuery);
1
  /**
2
+ * @preserve Sticky Anything 1.3.1 | @senff | GPL2 Licensed
3
  */
4
 
5
+ !function(e){function t(t,i,o,s,r,l,d){var m=e(".original").offset();if(orgElementTop=m.top,r){var h=e(r).offset();pushElementTop=h.top}var c=window,a="inner";"innerWidth"in window||(a="client",c=document.documentElement||document.body),viewport=c[a+"Width"],adminBarHeight=d&&e("body").hasClass("admin-bar")&&viewport>600?e("#wpadminbar").height():0,e(window).scrollTop()>=orgElementTop-t-adminBarHeight&&viewport>=i&&viewport<=o?(orgElement=e(".original"),coordsOrgElement=orgElement.offset(),leftOrgElement=coordsOrgElement.left,widthOrgElement=orgElement.css("width"),heightOrgElement=orgElement.outerHeight(),paddingOrgElement=[orgElement.css("padding-top"),orgElement.css("padding-right"),orgElement.css("padding-bottom"),orgElement.css("padding-left")],paddingCloned=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3],1==l&&e(".cloned").length<1&&n(t,s),elementHeight=0,elementHeight=heightOrgElement<1?e(".cloned").outerHeight():e(".original").outerHeight(),stickyTopMargin=r&&e(window).scrollTop()>pushElementTop-t-elementHeight-adminBarHeight?pushElementTop-t-elementHeight-e(window).scrollTop():adminBarHeight,e(".cloned").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthOrgElement).css("margin-top",stickyTopMargin).css("padding",paddingCloned).show(),e(".original").css("visibility","hidden")):(1==l?e(".cloned").remove():e(".cloned").hide(),e(".original").css("visibility","visible"))}function n(t,n){e(".original").clone().insertAfter(e(".original")).addClass("cloned").css("position","fixed").css("top",t+"px").css("margin-left","0").css("z-index",n).removeClass("original").hide()}e.fn.stickThis=function(i){var o=e.extend({top:0,minscreenwidth:0,maxscreenwidth:99999,zindex:1,dynamicmode:!1,debugmode:!1,pushup:"",adminbar:!1},i),s=e(this).length,r=e(o.pushup).length;return 1>r?(1==o.debugmode&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the Push-up element ("'+o.pushup+'").'),o.pushup=""):r>1&&(1==o.debugmode&&console.error("STICKY ANYTHING DEBUG: There are "+r+' elements on the page with the selector/class/ID you selected for the push-up element ("'+o.pushup+'"). You can select only ONE element to push the sticky element up.'),o.pushup=""),1>s?1==o.debugmode&&console.error('STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'").'):s>1?1==o.debugmode&&console.error("STICKY ANYTHING DEBUG: There There are "+r+' elements with the selector/class/ID you selected for the sticky element ("'+this.selector+'"). You can only make ONE element sticky.'):(e(this).addClass("original"),1!=o.dynamicmode&&n(o.top,o.zindex,o.adminbar),checkElement=setInterval(function(){t(o.top,o.minscreenwidth,o.maxscreenwidth,o.zindex,o.pushup,o.dynamicmode,o.adminbar)},10)),this}}(jQuery);
assets/js/stickThis.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * @preserve Sticky Anything 1.3 | @senff | GPL2 Licensed
3
  */
4
 
5
  (function($) {
1
  /**
2
+ * @preserve Sticky Anything 1.3.1 | @senff | GPL2 Licensed
3
  */
4
 
5
  (function($) {
assets/js/sticky-anything-admin.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * @preserve Sticky Anything 1.3 | @senff | GPL2 Licensed
3
  */
4
 
5
  jQuery(function($) {
1
  /**
2
+ * @preserve Sticky Anything 1.3.1 | @senff | GPL2 Licensed
3
  */
4
 
5
  jQuery(function($) {
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Sticky Menu (or Anything!) on Scroll ===
2
  Contributors: senff
3
  Donate link: http://www.senff.com/donate
4
- Tags: plugin, sticky, menu, scroll, element
5
  Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
6
  Requires at least: 3.6
7
- Tested up to: 4.2.2
8
- Stable tag: 1.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -96,6 +96,9 @@ The plugin's own page can be found [here](http://www.senff.com/plugins/sticky-an
96
 
97
  == Changelog ==
98
 
 
 
 
99
  = 1.3 =
100
  * Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
101
  * Added functionality to push sticky element up by another element lower down the page
@@ -136,6 +139,9 @@ The plugin's own page can be found [here](http://www.senff.com/plugins/sticky-an
136
 
137
  == Upgrade Notice ==
138
 
 
 
 
139
  = 1.3 =
140
  * BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
141
 
1
  === Sticky Menu (or Anything!) on Scroll ===
2
  Contributors: senff
3
  Donate link: http://www.senff.com/donate
4
+ Tags: sticky header, sticky menu, sticky, header, menu
5
  Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
6
  Requires at least: 3.6
7
+ Tested up to: 4.5
8
+ Stable tag: 1.3.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
96
 
97
  == Changelog ==
98
 
99
+ = 1.3.1 =
100
+ * Minor bug fix for push-up element
101
+
102
  = 1.3 =
103
  * Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
104
  * Added functionality to push sticky element up by another element lower down the page
139
 
140
  == Upgrade Notice ==
141
 
142
+ = 1.3.1 =
143
+ * Minor bug fix for push-up element
144
+
145
  = 1.3 =
146
  * BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
147
 
sticky-menu-or-anything.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
5
  Description: Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.
6
  Author: Mark Senff
7
  Author URI: http://www.senff.com
8
- Version: 1.3
9
  */
10
 
11
  defined('ABSPATH') or die('INSERT COIN');
@@ -20,7 +20,7 @@ defined('ABSPATH') or die('INSERT COIN');
20
  */
21
  if (!function_exists('sticky_anthing_default_options')) {
22
  function sticky_anthing_default_options() {
23
- $versionNum = '1.3';
24
  if (get_option('sticky_anything_options') === false) {
25
  $new_options['sa_version'] = $versionNum;
26
  $new_options['sa_element'] = '';
@@ -44,7 +44,7 @@ if (!function_exists('sticky_anthing_default_options')) {
44
  */
45
  if (!function_exists('sticky_anything_update')) {
46
  function sticky_anything_update() {
47
- $versionNum = '1.3';
48
  $existing_options = get_option('sticky_anything_options');
49
 
50
  if(!isset($existing_options['sa_minscreenwidth'])) {
5
  Description: Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.
6
  Author: Mark Senff
7
  Author URI: http://www.senff.com
8
+ Version: 1.3.1
9
  */
10
 
11
  defined('ABSPATH') or die('INSERT COIN');
20
  */
21
  if (!function_exists('sticky_anthing_default_options')) {
22
  function sticky_anthing_default_options() {
23
+ $versionNum = '1.3.1';
24
  if (get_option('sticky_anything_options') === false) {
25
  $new_options['sa_version'] = $versionNum;
26
  $new_options['sa_element'] = '';
44
  */
45
  if (!function_exists('sticky_anything_update')) {
46
  function sticky_anything_update() {
47
+ $versionNum = '1.3.1';
48
  $existing_options = get_option('sticky_anything_options');
49
 
50
  if(!isset($existing_options['sa_minscreenwidth'])) {