myStickymenu - Version 2.0.1

Version Description

  • Fixed: If user logged in but admin bar is not showing (error to calculate activation height)
  • Fixed: Admin style conflict with Scripts n Styles plugin
Download this release

Release Info

Developer damiroquai
Plugin Icon 128x128 myStickymenu
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0 to 2.0.1

Files changed (4) hide show
  1. js/mystickymenu.js +11 -3
  2. js/mystickymenu.min.js +1 -1
  3. mystickymenu.php +28 -28
  4. readme.txt +5 -1
js/mystickymenu.js CHANGED
@@ -1,6 +1,6 @@
1
  /*!
2
  * myStickymenu by m.r.d.a
3
- * v2
4
  */
5
 
6
  (function( $ ) {
@@ -206,8 +206,16 @@
206
 
207
 
208
  if ((adminBar == "true" ) && (viewportWidth > 600)) {
209
- // below 600 px adminbar is not fixed anymore
210
- adminBarHeight = $('#wpadminbar').height();
 
 
 
 
 
 
 
 
211
 
212
 
213
 
1
  /*!
2
  * myStickymenu by m.r.d.a
3
+ * v2.0.1
4
  */
5
 
6
  (function( $ ) {
206
 
207
 
208
  if ((adminBar == "true" ) && (viewportWidth > 600)) {
209
+
210
+ if ($("#wpadminbar")[0]){
211
+
212
+ adminBarHeight = $('#wpadminbar').height();
213
+
214
+ } else {
215
+
216
+ adminBarHeight = 0;
217
+
218
+ }
219
 
220
 
221
 
js/mystickymenu.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";jQuery(document).ready(function(e){function t(e){var e=window,t="inner";"innerWidth"in window||(t="client",e=document.documentElement||document.body),c=e[t+"Width"]}function i(){b=p.offsetHeight,parseInt(e(p).css("marginBottom"))>0&&(w.style.marginBottom=e(p).css("marginBottom")),"0"==b&&e(p).children().filter(":visible").each(function(){b=e(this).outerHeight(!0)})}function o(){p.classList.add("myfixed"),C=e(".myfixed").outerHeight(),"0"==C&&e(".myfixed").children().filter(":visible").each(function(){C=e(this).outerHeight(!0)}),p.classList.remove("myfixed")}function s(){B="true"==u&&c>600?e("#wpadminbar").height():0,"on"==m?k.style.top="-"+C+"px":k.style.top=B+"px"}function n(){var t=e(p)[0].getBoundingClientRect();S=t.width}function d(){1==E&&("on"==m&&(y=e(p).offset().top+b-B,H=e(p).offset().top+b-B,"on"==v&&(H=e(p).offset().top-B)),"fade"==m&&("false"==v&&(y=e(p).offset().top-B,H=e(p).offset().top-B),"on"==v&&(y=e(p).offset().top-B+b,H=e(p).offset().top-B)))}function a(){1==E&&b>C&&("on"==m?(H=y,"on"==v&&(H=y-C)):(y=b,H=b))}function r(e){if(c>=f){var t=N?window.scrollY:document.documentElement.scrollTop;if(t>=0){if(t>=I)t>=y?p.classList.add("myfixed"):"",t>=y?k.classList.add("wrapfixed"):"",t>=y?w.style.height=b+"px":"",t>=y?p.style.width=S+"px":"","on"==m&&("false"==v&&(t>=y+C-B?k.style.top=B+"px":k.style.top="-"+C+"px"),b>C&&"false"==v&&(y+C>t?k.style.top="-"+b+"px":"",t>=y+C?k.style.top=B+"px":"")),k.classList.add("down"),k.classList.remove("up"),"on"==v&&(k.style.top="-"+(b+B)+"px");else{var i=N?window.scrollY:document.documentElement.scrollTop;i>H?"":w.style.height="",i>H?"":p.style.width="","on"==m?(i>H?"":p.classList.remove("myfixed"),i>H?"":k.classList.remove("wrapfixed"),"false"==v&&(H+C+200-B>i?k.style.top="-"+C+"px":"")):(i>H?"":p.classList.remove("myfixed"),i>H?"":k.classList.remove("wrapfixed")),k.classList.remove("down"),k.classList.add("up"),"on"==v&&(k.style.top=B+"px")}I=t}else k.classList.remove("up")}}function l(){e(window).width()!=T&&(k.classList.remove("up"),k.classList.remove("down"),e(".wrapfixed")[0]?(p.classList.remove("myfixed"),k.classList.remove("wrapfixed")):(i(),p.style.removeProperty("width"),n()),t(),s(),o(),d(),a())}if(e(option.mystickyClass)[0]){var c,p=document.querySelector(option.mystickyClass),f=parseInt(option.disableWidth),m=option.mystickyTransition,y=parseInt(option.activationHeight),u=option.adminBar,v=option.mysticky_disable_down;t();for(var h=p.parentNode,w=document.createElement("div"),x=0,L=0;L<h.childNodes.length;L++)if(h.childNodes[L]==p){x=L;break}w.id="mysticky-wrap",w.appendChild(p),h.insertBefore(w,h.childNodes[x]);var g=p.parentNode,k=document.createElement("div");if(k.id="mysticky-nav",g.replaceChild(k,p),k.appendChild(p),"0"==y)var E=!0;var b;i();var C;o();var B=0;s();var S;n();var H=y;d(),a();var N="scrollY"in window,I=0;document.addEventListener("scroll",r);var T=e(window).width();window.addEventListener("resize",l),window.addEventListener("orientationchange",l)}else console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ")})}(jQuery);
1
+ !function(e){"use strict";jQuery(document).ready(function(e){function t(e){var e=window,t="inner";"innerWidth"in window||(t="client",e=document.documentElement||document.body),c=e[t+"Width"]}function i(){E=p.offsetHeight,parseInt(e(p).css("marginBottom"))>0&&(w.style.marginBottom=e(p).css("marginBottom")),"0"==E&&e(p).children().filter(":visible").each(function(){E=e(this).outerHeight(!0)})}function o(){p.classList.add("myfixed"),C=e(".myfixed").outerHeight(),"0"==C&&e(".myfixed").children().filter(":visible").each(function(){C=e(this).outerHeight(!0)}),p.classList.remove("myfixed")}function s(){B="true"==u&&c>600&&e("#wpadminbar")[0]?e("#wpadminbar").height():0,"on"==m?k.style.top="-"+C+"px":k.style.top=B+"px"}function n(){var t=e(p)[0].getBoundingClientRect();S=t.width}function d(){1==b&&("on"==m&&(y=e(p).offset().top+E-B,H=e(p).offset().top+E-B,"on"==v&&(H=e(p).offset().top-B)),"fade"==m&&("false"==v&&(y=e(p).offset().top-B,H=e(p).offset().top-B),"on"==v&&(y=e(p).offset().top-B+E,H=e(p).offset().top-B)))}function a(){1==b&&E>C&&("on"==m?(H=y,"on"==v&&(H=y-C)):(y=E,H=E))}function r(e){if(c>=f){var t=N?window.scrollY:document.documentElement.scrollTop;if(t>=0){if(t>=I)t>=y?p.classList.add("myfixed"):"",t>=y?k.classList.add("wrapfixed"):"",t>=y?w.style.height=E+"px":"",t>=y?p.style.width=S+"px":"","on"==m&&("false"==v&&(t>=y+C-B?k.style.top=B+"px":k.style.top="-"+C+"px"),E>C&&"false"==v&&(y+C>t?k.style.top="-"+E+"px":"",t>=y+C?k.style.top=B+"px":"")),k.classList.add("down"),k.classList.remove("up"),"on"==v&&(k.style.top="-"+(E+B)+"px");else{var i=N?window.scrollY:document.documentElement.scrollTop;i>H?"":w.style.height="",i>H?"":p.style.width="","on"==m?(i>H?"":p.classList.remove("myfixed"),i>H?"":k.classList.remove("wrapfixed"),"false"==v&&(H+C+200-B>i?k.style.top="-"+C+"px":"")):(i>H?"":p.classList.remove("myfixed"),i>H?"":k.classList.remove("wrapfixed")),k.classList.remove("down"),k.classList.add("up"),"on"==v&&(k.style.top=B+"px")}I=t}else k.classList.remove("up")}}function l(){e(window).width()!=T&&(k.classList.remove("up"),k.classList.remove("down"),e(".wrapfixed")[0]?(p.classList.remove("myfixed"),k.classList.remove("wrapfixed")):(i(),p.style.removeProperty("width"),n()),t(),s(),o(),d(),a())}if(e(option.mystickyClass)[0]){var c,p=document.querySelector(option.mystickyClass),f=parseInt(option.disableWidth),m=option.mystickyTransition,y=parseInt(option.activationHeight),u=option.adminBar,v=option.mysticky_disable_down;t();for(var h=p.parentNode,w=document.createElement("div"),x=0,L=0;L<h.childNodes.length;L++)if(h.childNodes[L]==p){x=L;break}w.id="mysticky-wrap",w.appendChild(p),h.insertBefore(w,h.childNodes[x]);var g=p.parentNode,k=document.createElement("div");if(k.id="mysticky-nav",g.replaceChild(k,p),k.appendChild(p),"0"==y)var b=!0;var E;i();var C;o();var B=0;s();var S;n();var H=y;d(),a();var N="scrollY"in window,I=0;document.addEventListener("scroll",r);var T=e(window).width();window.addEventListener("resize",l),window.addEventListener("orientationchange",l)}else console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ")})}(jQuery);
mystickymenu.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: myStickymenu
4
  Plugin URI: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
5
  Description: Simple sticky (fixed on top) menu implementation for navigation menu. After install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6
- Version: 2.0
7
  Author: m.r.d.a
8
  Author URI: http://wordpress.transformnews.com/
9
  Text Domain: mystickymenu
@@ -12,7 +12,7 @@
12
  */
13
 
14
  defined('ABSPATH') or die("Cannot access pages directly.");
15
- define( 'MYSTICKY_VERSION', '2.0' );
16
 
17
  class MyStickyMenuBackend
18
  {
@@ -34,7 +34,7 @@ class MyStickyMenuBackend
34
 
35
 
36
  public function mysticky_admin_script() {
37
- echo '<style type="text/css">.general,.style,.advanced,.hideform,.hideformreset{display:none;}</style>';
38
  echo '
39
  <script>
40
 
@@ -47,8 +47,8 @@ public function mysticky_admin_script() {
47
  $("#myfixed_zindex,#myfixed_opacity,#myfixed_transition_time,#disable_css").parent().parent().parent().hide();
48
  $("#myfixed_bgcolor").parent().parent().parent().hide();
49
  $("#myfixed_cssstyle,#mysticky_disable_at_front_home").parent().parent().hide();
50
- $(".hideformreset").hide();
51
- $(".hideform,.general").fadeIn(300);
52
 
53
 
54
  $(".btn-general").click(function(){
@@ -60,8 +60,8 @@ public function mysticky_admin_script() {
60
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().hide();
61
  $("#myfixed_cssstyle,#mysticky_disable_at_front_home").parent().parent().hide();
62
 
63
- $(".general").fadeIn(300);
64
- $(".style,.advanced,.hideformreset") .hide();
65
 
66
 
67
 
@@ -90,10 +90,10 @@ public function mysticky_admin_script() {
90
 
91
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().show();
92
 
93
- $(".general").hide();
94
- $(".hideformreset").hide();
95
- $(".style") .fadeIn(300);
96
- $(".advanced").hide();
97
 
98
  });
99
 
@@ -113,11 +113,11 @@ public function mysticky_admin_script() {
113
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().hide();
114
 
115
  $("#mysticky_disable_at_front_home").parent().parent().show();
116
- $(".hideformreset").fadeIn(300);
117
 
118
- $(".general").hide();
119
- $(".style") .hide();
120
- $(".advanced").fadeIn(300);
121
 
122
 
123
 
@@ -169,12 +169,12 @@ public function mysticky_admin_script() {
169
 
170
 
171
 
172
- <?php $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general'; ?>
173
 
174
  <h2 class="nav-tab-wrapper">
175
- <a class="nav-tab btn-general <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>">General Settings</a>
176
- <a class="nav-tab btn-style <?php echo $active_tab == 'style' ? 'nav-tab-active' : ''; ?>">Style</a>
177
- <a class="nav-tab btn-advanced <?php echo $active_tab == 'advanced' ? 'nav-tab-active' : ''; ?>">Advanced</a>
178
  </h2>
179
 
180
 
@@ -185,7 +185,7 @@ public function mysticky_admin_script() {
185
 
186
 
187
 
188
- <form class="hideform" method="post" action="options.php">
189
 
190
 
191
 
@@ -198,25 +198,25 @@ public function mysticky_admin_script() {
198
  if(isset($_GET["tab"]))
199
  {
200
 
201
- if($_GET["tab"] == "general")
202
  {
203
- echo '<div class="general">';
204
  settings_fields( 'mysticky_option_group' );
205
  do_settings_sections( 'my-stickymenu-settings' );
206
  echo '</div>';
207
 
208
  }
209
- else if($_GET["tab"] == "style")
210
  {
211
- echo '<div class="style">';
212
  settings_fields( 'mysticky_option_group' );
213
  do_settings_sections( 'my-stickymenu-settings' );
214
  echo '</div>';
215
  }
216
 
217
- else if($_GET["tab"] == "advanced")
218
  {
219
- echo '<div class="advanced">';
220
  settings_fields( 'mysticky_option_group' );
221
  do_settings_sections( 'my-stickymenu-settings' );
222
  echo '</div>';
@@ -227,7 +227,7 @@ public function mysticky_admin_script() {
227
 
228
  else {
229
 
230
- // echo '<div class="general">';
231
  settings_fields( 'mysticky_option_group' );
232
  do_settings_sections( 'my-stickymenu-settings' );
233
  // echo '</div>';
@@ -242,7 +242,7 @@ public function mysticky_admin_script() {
242
 
243
  </form>
244
 
245
- <form class="hideformreset" method="post" action="">
246
  <input name="reset" class="button button-secondary confirm" type="submit" value="Reset to default settings" >
247
  <input type="hidden" name="action" value="reset" />
248
  </form>
3
  Plugin Name: myStickymenu
4
  Plugin URI: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
5
  Description: Simple sticky (fixed on top) menu implementation for navigation menu. After install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6
+ Version: 2.0.1
7
  Author: m.r.d.a
8
  Author URI: http://wordpress.transformnews.com/
9
  Text Domain: mystickymenu
12
  */
13
 
14
  defined('ABSPATH') or die("Cannot access pages directly.");
15
+ define( 'MYSTICKY_VERSION', '2.0.1' );
16
 
17
  class MyStickyMenuBackend
18
  {
34
 
35
 
36
  public function mysticky_admin_script() {
37
+ echo '<style type="text/css">.mysticky-general,.mysticky-style,.mysticky-advanced,.mysticky-hideform,.mysticky-hideformreset{display:none;}</style>';
38
  echo '
39
  <script>
40
 
47
  $("#myfixed_zindex,#myfixed_opacity,#myfixed_transition_time,#disable_css").parent().parent().parent().hide();
48
  $("#myfixed_bgcolor").parent().parent().parent().hide();
49
  $("#myfixed_cssstyle,#mysticky_disable_at_front_home").parent().parent().hide();
50
+ $(".mysticky-hideformreset").hide();
51
+ $(".mysticky-hideform,.mysticky-general").fadeIn(300);
52
 
53
 
54
  $(".btn-general").click(function(){
60
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().hide();
61
  $("#myfixed_cssstyle,#mysticky_disable_at_front_home").parent().parent().hide();
62
 
63
+ $(".mysticky-general").fadeIn(300);
64
+ $(".mysticky-style,.mysticky-advanced,.mysticky-hideformreset") .hide();
65
 
66
 
67
 
90
 
91
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().show();
92
 
93
+ $(".mysticky-general").hide();
94
+ $(".mysticky-hideformreset").hide();
95
+ $(".mysticky-style") .fadeIn(300);
96
+ $(".mysticky-advanced").hide();
97
 
98
  });
99
 
113
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().hide();
114
 
115
  $("#mysticky_disable_at_front_home").parent().parent().show();
116
+ $(".mysticky-hideformreset").fadeIn(300);
117
 
118
+ $(".mysticky-general").hide();
119
+ $(".mysticky-style") .hide();
120
+ $(".mysticky-advanced").fadeIn(300);
121
 
122
 
123
 
169
 
170
 
171
 
172
+ <?php $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'mysticky-general'; ?>
173
 
174
  <h2 class="nav-tab-wrapper">
175
+ <a class="nav-tab btn-general <?php echo $active_tab == 'mysticky-general' ? 'nav-tab-active' : ''; ?>">General Settings</a>
176
+ <a class="nav-tab btn-style <?php echo $active_tab == 'mysticky-style' ? 'nav-tab-active' : ''; ?>">Style</a>
177
+ <a class="nav-tab btn-advanced <?php echo $active_tab == 'mysticky-advanced' ? 'nav-tab-active' : ''; ?>">Advanced</a>
178
  </h2>
179
 
180
 
185
 
186
 
187
 
188
+ <form class="mysticky-hideform" method="post" action="options.php">
189
 
190
 
191
 
198
  if(isset($_GET["tab"]))
199
  {
200
 
201
+ if($_GET["tab"] == "mysticky-general")
202
  {
203
+ echo '<div class="mysticky-general">';
204
  settings_fields( 'mysticky_option_group' );
205
  do_settings_sections( 'my-stickymenu-settings' );
206
  echo '</div>';
207
 
208
  }
209
+ else if($_GET["tab"] == "mysticky-style")
210
  {
211
+ echo '<div class="mysticky-style">';
212
  settings_fields( 'mysticky_option_group' );
213
  do_settings_sections( 'my-stickymenu-settings' );
214
  echo '</div>';
215
  }
216
 
217
+ else if($_GET["tab"] == "mysticky-advanced")
218
  {
219
+ echo '<div class="mysticky-advanced">';
220
  settings_fields( 'mysticky_option_group' );
221
  do_settings_sections( 'my-stickymenu-settings' );
222
  echo '</div>';
227
 
228
  else {
229
 
230
+ // echo '<div class="mysticky-general">';
231
  settings_fields( 'mysticky_option_group' );
232
  do_settings_sections( 'my-stickymenu-settings' );
233
  // echo '</div>';
242
 
243
  </form>
244
 
245
+ <form class="mysticky-hideformreset" method="post" action="">
246
  <input name="reset" class="button button-secondary confirm" type="submit" value="Reset to default settings" >
247
  <input type="hidden" name="action" value="reset" />
248
  </form>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wordpress.transformnews.com/contact
4
  Tags: sticky, menu, header, sticky menu, sticky header, floating, floating menu
5
  Requires at least: 3.5.1
6
  Tested up to: 4.8.1
7
- Stable tag: 2.0
8
  License: GPLv2 or later
9
 
10
  This lightweight plugin will made your menu or header sticky on top of page, after desired number of pixels when scrolled.
@@ -54,6 +54,10 @@ In some cases you can use the whole header div and than just style it different
54
 
55
 
56
  == Changelog ==
 
 
 
 
57
  = 2.0 =
58
  * Added: If Make visible on Scroll is set to 0 automatic activation and deactivation scroll height will be used (useful for responsive designs).
59
  * Added: Tabs for settings.
4
  Tags: sticky, menu, header, sticky menu, sticky header, floating, floating menu
5
  Requires at least: 3.5.1
6
  Tested up to: 4.8.1
7
+ Stable tag: 2.0.1
8
  License: GPLv2 or later
9
 
10
  This lightweight plugin will made your menu or header sticky on top of page, after desired number of pixels when scrolled.
54
 
55
 
56
  == Changelog ==
57
+ = 2.0.1 =
58
+ * Fixed: If user logged in but admin bar is not showing (error to calculate activation height)
59
+ * Fixed: Admin style conflict with Scripts n Styles plugin
60
+
61
  = 2.0 =
62
  * Added: If Make visible on Scroll is set to 0 automatic activation and deactivation scroll height will be used (useful for responsive designs).
63
  * Added: Tabs for settings.