myStickymenu - Version 2.0.4

Version Description

  • Added: Hide for large screens
Download this release

Release Info

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

Code changes from version 2.0.3 to 2.0.4

Files changed (4) hide show
  1. js/mystickymenu.js +57 -127
  2. js/mystickymenu.min.js +1 -1
  3. mystickymenu.php +36 -5
  4. readme.txt +3 -1
js/mystickymenu.js CHANGED
@@ -1,24 +1,33 @@
1
  /*!
2
  * myStickymenu by m.r.d.a
3
- * v2.0.1
4
  */
5
 
6
  (function( $ ) {
7
  "use strict";
8
 
9
- jQuery(document).ready(function($){
10
-
11
-
12
 
13
  // get Sticky Class setting if class name existts
14
- if ($(option.mystickyClass)[0]){
 
 
 
 
 
 
 
 
15
 
16
- // Do something if class exists
17
  var mystickyClass = document.querySelector(option.mystickyClass);
18
 
19
  // get disable at small screen size setting
20
  var disableWidth = parseInt(option.disableWidth);
21
 
 
 
 
22
  // get body width
23
  //var bodyWidth = parseInt(document.body.clientWidth);
24
 
@@ -34,12 +43,7 @@
34
  // disable on scroll down
35
  var mysticky_disable_down = option.mysticky_disable_down;
36
 
37
-
38
-
39
-
40
-
41
-
42
-
43
 
44
 
45
  var viewportWidth;
@@ -90,11 +94,7 @@
90
  parentnav.replaceChild(wrappernav, mystickyClass);
91
  wrappernav.appendChild(mystickyClass);
92
 
93
-
94
-
95
-
96
-
97
-
98
 
99
 
100
  // get activation height from settings
@@ -103,19 +103,6 @@
103
  }
104
 
105
 
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
 
120
 
121
 
@@ -126,7 +113,6 @@
126
 
127
 
128
 
129
-
130
  // get initial element height of selected sticky class
131
  mydivHeight = (mystickyClass.offsetHeight);
132
 
@@ -191,14 +177,7 @@
191
 
192
 
193
 
194
-
195
-
196
-
197
-
198
-
199
-
200
- var adminBarHeight = 0;
201
-
202
 
203
  function calcAdminBarHeight(){
204
 
@@ -248,11 +227,6 @@
248
 
249
 
250
 
251
-
252
-
253
-
254
-
255
-
256
  var mydivWidth;
257
 
258
 
@@ -270,23 +244,11 @@
270
  initialDivWidth();
271
 
272
 
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
 
287
  var deactivationHeight = activationHeight;
288
 
289
- function CalcActivationHeight() {
290
 
291
  // If activate height (Make visible on Scroll) is set to 0, automatic calculation will be used.
292
  if ( autoActivate == true ) {
@@ -330,14 +292,14 @@
330
 
331
  }
332
 
333
- CalcActivationHeight();
334
 
335
 
336
 
337
 
338
 
339
 
340
- function HeaderDeactivateOnHeight() {
341
 
342
 
343
  if ( autoActivate == true ) {
@@ -369,12 +331,9 @@
369
 
370
  }
371
 
372
- HeaderDeactivateOnHeight();
373
-
374
-
375
-
376
-
377
 
 
378
 
379
  var hasScrollY = 'scrollY' in window;
380
  var lastScrollTop = 0;
@@ -382,9 +341,7 @@
382
 
383
  function onScroll(e) {
384
 
385
-
386
-
387
-
388
  //initialDivHeight();
389
 
390
  // if body width is larger than disable at small screen size setting
@@ -393,9 +350,13 @@
393
 
394
 
395
  if (viewportWidth >= disableWidth) {
396
-
397
-
398
-
 
 
 
 
399
  //if (mysticky_disable_down == "on") {
400
 
401
  var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
@@ -511,27 +472,30 @@
511
  }
512
 
513
 
514
- }
 
 
 
 
 
 
515
 
516
  }
517
 
518
  document.addEventListener('scroll', onScroll);
519
 
 
 
520
 
521
- var width = $(window).width()
522
 
523
- function OnResizeDocument () {
524
-
525
-
526
 
527
-
528
- if($(window).width() != width ){
 
529
 
530
 
531
-
532
-
533
-
534
-
535
  wrappernav.classList.remove('up');
536
  wrappernav.classList.remove('down');
537
 
@@ -550,59 +514,25 @@ if($(window).width() != width ){
550
  // Remove width
551
  mystickyClass.style.removeProperty("width");
552
  initialDivWidth();
553
-
554
-
555
- // Calculate new width - need to put this in function like height
556
- //var mydivWidth = ((mystickyClass.offsetWidth) + 'px');
557
- //mystickyClass.style.width = mydivWidth;
558
-
559
-
560
-
561
- // var rect = $(mystickyClass)[0].getBoundingClientRect();
562
- // var mydivWidth = rect.width + "px";
563
-
564
- //var mydivWidth = ((mystickyClass.offsetWidth) + 'px');
565
- // mystickyClass.style.width = mydivWidth;
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
  }
576
  calcViewportWidth();
577
  calcAdminBarHeight();
578
  fixedDivHeight();
 
 
579
 
580
- CalcActivationHeight();
581
- HeaderDeactivateOnHeight();
582
-
583
- }
584
 
585
- }
586
 
587
- window.addEventListener('resize', OnResizeDocument);
588
-
589
- //var lazyLayout = OnResizeDocument().debounce(calculateLayout, 300);
590
- //$(window).resize(lazyLayout);
591
-
592
- //window.addEventListener('resize', lazyLayout);
593
-
594
- // need to test this, it should fire script on mobile orientation change, since onresize is somehow faulty in this case
595
- window.addEventListener('orientationchange', OnResizeDocument);
596
 
597
- //}
598
-
599
-
600
- }
601
-
602
- else {
603
- console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ");
604
- // Do something if class does not exist
605
- }
606
 
607
  });
608
 
1
  /*!
2
  * myStickymenu by m.r.d.a
3
+ * v2.0.4
4
  */
5
 
6
  (function( $ ) {
7
  "use strict";
8
 
9
+ $(document).ready(function($){
 
 
10
 
11
  // get Sticky Class setting if class name existts
12
+ if ($(option.mystickyClass) [0]){
13
+ // Do nothing
14
+ }
15
+ else {
16
+ // Do something if class does not exist and stop
17
+ console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ");
18
+ return;
19
+ }
20
+
21
 
22
+ // Get class name
23
  var mystickyClass = document.querySelector(option.mystickyClass);
24
 
25
  // get disable at small screen size setting
26
  var disableWidth = parseInt(option.disableWidth);
27
 
28
+ // get disable at large screen size setting
29
+ var disableLargeWidth = parseInt(option.disableLargeWidth);
30
+
31
  // get body width
32
  //var bodyWidth = parseInt(document.body.clientWidth);
33
 
43
  // disable on scroll down
44
  var mysticky_disable_down = option.mysticky_disable_down;
45
 
46
+
 
 
 
 
 
47
 
48
 
49
  var viewportWidth;
94
  parentnav.replaceChild(wrappernav, mystickyClass);
95
  wrappernav.appendChild(mystickyClass);
96
 
97
+
 
 
 
 
98
 
99
 
100
  // get activation height from settings
103
  }
104
 
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
 
108
 
113
 
114
 
115
 
 
116
  // get initial element height of selected sticky class
117
  mydivHeight = (mystickyClass.offsetHeight);
118
 
177
 
178
 
179
 
180
+ var adminBarHeight = 0;
 
 
 
 
 
 
 
181
 
182
  function calcAdminBarHeight(){
183
 
227
 
228
 
229
 
 
 
 
 
 
230
  var mydivWidth;
231
 
232
 
244
  initialDivWidth();
245
 
246
 
247
+
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
  var deactivationHeight = activationHeight;
250
 
251
+ function calcActivationHeight() {
252
 
253
  // If activate height (Make visible on Scroll) is set to 0, automatic calculation will be used.
254
  if ( autoActivate == true ) {
292
 
293
  }
294
 
295
+ calcActivationHeight();
296
 
297
 
298
 
299
 
300
 
301
 
302
+ function headerDeactivateOnHeight() {
303
 
304
 
305
  if ( autoActivate == true ) {
331
 
332
  }
333
 
334
+ headerDeactivateOnHeight();
 
 
 
 
335
 
336
+
337
 
338
  var hasScrollY = 'scrollY' in window;
339
  var lastScrollTop = 0;
341
 
342
  function onScroll(e) {
343
 
344
+
 
 
345
  //initialDivHeight();
346
 
347
  // if body width is larger than disable at small screen size setting
350
 
351
 
352
  if (viewportWidth >= disableWidth) {
353
+
354
+
355
+
356
+ if ( disableLargeWidth == 0 || viewportWidth <= disableLargeWidth ) {
357
+
358
+
359
+
360
  //if (mysticky_disable_down == "on") {
361
 
362
  var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
472
  }
473
 
474
 
475
+ } // if disableWidth is greater than zero
476
+
477
+
478
+ } // if disableLargeWidth is 0 or greater than zero
479
+
480
+
481
+
482
 
483
  }
484
 
485
  document.addEventListener('scroll', onScroll);
486
 
487
+
488
+
489
 
490
+ var width = $(window).width()
491
 
492
+ function OnResizeDocument () {
 
 
493
 
494
+
495
+ // don't recalculate on height change, only width
496
+ if($(window).width() != width ){
497
 
498
 
 
 
 
 
499
  wrappernav.classList.remove('up');
500
  wrappernav.classList.remove('down');
501
 
514
  // Remove width
515
  mystickyClass.style.removeProperty("width");
516
  initialDivWidth();
517
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
  }
519
  calcViewportWidth();
520
  calcAdminBarHeight();
521
  fixedDivHeight();
522
+ calcActivationHeight();
523
+ headerDeactivateOnHeight();
524
 
525
+ }
 
 
 
526
 
527
+ }
528
 
529
+ window.addEventListener('resize', OnResizeDocument);
530
+
531
+ // need to test this, it should fire script on mobile orientation change, since onresize is somehow faulty in this case
532
+ window.addEventListener('orientationchange', OnResizeDocument);
533
+
534
+
 
 
 
535
 
 
 
 
 
 
 
 
 
 
536
 
537
  });
538
 
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(){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);
1
+ !function(e){"use strict";e(document).ready(function(e){if(e(option.mystickyClass)[0]){var t,i=document.querySelector(option.mystickyClass),o=parseInt(option.disableWidth),s=parseInt(option.disableLargeWidth),n=option.mystickyTransition,d=parseInt(option.activationHeight),a=option.adminBar,r=option.mysticky_disable_down;E();for(var l=i.parentNode,c=document.createElement("div"),p=0,f=0;f<l.childNodes.length;f++)if(l.childNodes[f]==i){p=f;break}c.id="mysticky-wrap",c.appendChild(i),l.insertBefore(c,l.childNodes[p]);var m,y,u=i.parentNode,h=document.createElement("div");if(h.id="mysticky-nav",u.replaceChild(h,i),h.appendChild(i),"0"==d)var w=!0;C(),B();var v,x=0;S(),H();var L=d;N(),I();var g="scrollY"in window,k=0;document.addEventListener("scroll",function(e){if(t>=o&&(0==s||t<=s)){var a=g?window.scrollY:document.documentElement.scrollTop;if(0<=a){if(a>=k)a>=d&&i.classList.add("myfixed"),a>=d&&h.classList.add("wrapfixed"),a>=d&&(c.style.height=m+"px"),a>=d&&(i.style.width=v+"px"),"on"==n&&("false"==r&&(h.style.top=a>=d+y-x?x+"px":"-"+y+"px"),m>y&&"false"==r&&(a<d+y&&(h.style.top="-"+m+"px"),a>=d+y&&(h.style.top=x+"px"))),h.classList.add("down"),h.classList.remove("up"),"on"==r&&(h.style.top="-"+(m+x)+"px");else{var l=g?window.scrollY:document.documentElement.scrollTop;!(l>L)&&(c.style.height=""),!(l>L)&&(i.style.width=""),"on"==n?(!(l>L)&&i.classList.remove("myfixed"),!(l>L)&&h.classList.remove("wrapfixed"),"false"==r&&l<L+y+200-x&&(h.style.top="-"+y+"px")):(!(l>L)&&i.classList.remove("myfixed"),!(l>L)&&h.classList.remove("wrapfixed")),h.classList.remove("down"),h.classList.add("up"),"on"==r&&(h.style.top=x+"px")}k=a}else h.classList.remove("up")}});var b=e(window).width();window.addEventListener("resize",W),window.addEventListener("orientationchange",W)}else console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ");function E(e){e=window;var i="inner";"innerWidth"in window||(i="client",e=document.documentElement||document.body),t=e[i+"Width"]}function C(){m=i.offsetHeight,parseInt(e(i).css("marginBottom"))>0&&(c.style.marginBottom=e(i).css("marginBottom")),"0"==m&&e(i).children().filter(":visible").each(function(){m=e(this).outerHeight(!0)})}function B(){i.classList.add("myfixed"),"0"==(y=e(".myfixed").outerHeight())&&e(".myfixed").children().filter(":visible").each(function(){y=e(this).outerHeight(!0)}),i.classList.remove("myfixed")}function S(){x="true"==a&&t>600&&e("#wpadminbar")[0]?e("#wpadminbar").height():0,h.style.top="on"==n?"-"+y+"px":x+"px"}function H(){var t=e(i)[0].getBoundingClientRect();v=t.width}function N(){1==w&&("on"==n&&(d=e(i).offset().top+m-x,L=e(i).offset().top+m-x,"on"==r&&(L=e(i).offset().top-x)),"fade"==n&&("false"==r&&(d=e(i).offset().top-x,L=e(i).offset().top-x),"on"==r&&(d=e(i).offset().top-x+m,L=e(i).offset().top-x)))}function I(){1==w&&m>y&&("on"==n?(L=d,"on"==r&&(L=d-y)):(d=m,L=m))}function W(){e(window).width()!=b&&(h.classList.remove("up"),h.classList.remove("down"),e(".wrapfixed")[0]?(i.classList.remove("myfixed"),h.classList.remove("wrapfixed")):(C(),i.style.removeProperty("width"),H()),E(),S(),B(),N(),I())}})}(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.3
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.3' );
16
 
17
  class MyStickyMenuBackend
18
  {
@@ -55,7 +55,7 @@ public function mysticky_admin_script() {
55
 
56
  $(".btn-general").addClass("nav-tab-active");
57
  $(".btn-style,.btn-advanced").removeClass("nav-tab-active");
58
- $("#mysticky_class_selector,#myfixed_disable_small_screen,#mysticky_active_on_height,#mysticky_active_on_height_home,#myfixed_fade").parent().parent().parent().show();
59
  $("#myfixed_zindex,#myfixed_opacity,#myfixed_transition_time,#disable_css").parent().parent().parent().hide();
60
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().parent().hide();
61
 
@@ -81,7 +81,7 @@ public function mysticky_admin_script() {
81
  $(".btn-general,.btn-advanced").removeClass("nav-tab-active");
82
 
83
 
84
- $("#mysticky_class_selector,#myfixed_disable_small_screen,#mysticky_active_on_height,#mysticky_active_on_height_home,#myfixed_fade").parent().parent().parent().hide();
85
  $("#myfixed_zindex,#myfixed_bgcolor,#myfixed_opacity,#myfixed_transition_time,#disable_css").parent().parent().parent().show();
86
  $("#myfixed_cssstyle").parent().parent().show();
87
  $("#mysticky_disable_at_front_home").parent().parent().hide();
@@ -104,7 +104,7 @@ public function mysticky_admin_script() {
104
  $(".btn-advanced").addClass("nav-tab-active");
105
  $(".btn-style,.btn-general").removeClass("nav-tab-active");
106
 
107
- $("#mysticky_class_selector,#myfixed_disable_small_screen,#mysticky_active_on_height,#mysticky_active_on_height_home,#myfixed_fade").parent().parent().parent().hide();
108
  $("#myfixed_zindex,#myfixed_opacity,#myfixed_transition_time,#disable_css").parent().parent().parent().hide();
109
  $("#myfixed_cssstyle").parent().parent().hide();
110
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().parent().hide();
@@ -324,6 +324,13 @@ public function mysticky_admin_script() {
324
  'my-stickymenu-settings',
325
  'setting_section_id'
326
  );
 
 
 
 
 
 
 
327
  add_settings_field(
328
  'mysticky_active_on_height',
329
  __("Make visible on Scroll", 'mystickymenu'),
@@ -454,6 +461,9 @@ public function mysticky_admin_script() {
454
 
455
  if( isset( $input['myfixed_disable_small_screen'] ) )
456
  $new_input['myfixed_disable_small_screen'] = absint( $input['myfixed_disable_small_screen'] );
 
 
 
457
 
458
  if( isset( $input['mysticky_active_on_height'] ) )
459
  $new_input['mysticky_active_on_height'] = absint( $input['mysticky_active_on_height'] );
@@ -524,6 +534,7 @@ public function mysticky_admin_script() {
524
  'myfixed_opacity' => '90',
525
  'myfixed_transition_time' => '0.3',
526
  'myfixed_disable_small_screen' => '0',
 
527
  'mysticky_active_on_height' => '0',
528
  'mysticky_active_on_height_home' => '0',
529
  'myfixed_fade' => 'on',
@@ -616,6 +627,24 @@ public function mysticky_admin_script() {
616
  echo __("px width, 0 to disable.", 'mystickymenu');
617
  echo '</p>';
618
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
 
620
  public function mysticky_active_on_height_callback()
621
  {
@@ -909,11 +938,13 @@ class MyStickyMenuFrontend
909
 
910
  $myfixed_disable_scroll_down = isset($mysticky_options['myfixed_disable_scroll_down']) ? $mysticky_options['myfixed_disable_scroll_down'] : 'false';
911
  $mystickyTransition = isset($mysticky_options['myfixed_fade']) ? $mysticky_options['myfixed_fade'] : 'fade';
 
912
 
913
  $mysticky_translation_array = array(
914
  'mystickyClass' => $mysticky_options['mysticky_class_selector'] ,
915
  'activationHeight' => $mysticky_options['mysticky_active_on_height'],
916
  'disableWidth' => $mysticky_options['myfixed_disable_small_screen'],
 
917
  'adminBar' => $top,
918
  'mystickyTransition' => $mystickyTransition,
919
  'mysticky_disable_down' => $myfixed_disable_scroll_down,
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.4
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.4' );
16
 
17
  class MyStickyMenuBackend
18
  {
55
 
56
  $(".btn-general").addClass("nav-tab-active");
57
  $(".btn-style,.btn-advanced").removeClass("nav-tab-active");
58
+ $("#mysticky_class_selector,#myfixed_disable_small_screen,#myfixed_disable_large_screen,#mysticky_active_on_height,#mysticky_active_on_height_home,#myfixed_fade").parent().parent().parent().show();
59
  $("#myfixed_zindex,#myfixed_opacity,#myfixed_transition_time,#disable_css").parent().parent().parent().hide();
60
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().parent().hide();
61
 
81
  $(".btn-general,.btn-advanced").removeClass("nav-tab-active");
82
 
83
 
84
+ $("#mysticky_class_selector,#myfixed_disable_small_screen,#myfixed_disable_large_screen,#mysticky_active_on_height,#mysticky_active_on_height_home,#myfixed_fade").parent().parent().parent().hide();
85
  $("#myfixed_zindex,#myfixed_bgcolor,#myfixed_opacity,#myfixed_transition_time,#disable_css").parent().parent().parent().show();
86
  $("#myfixed_cssstyle").parent().parent().show();
87
  $("#mysticky_disable_at_front_home").parent().parent().hide();
104
  $(".btn-advanced").addClass("nav-tab-active");
105
  $(".btn-style,.btn-general").removeClass("nav-tab-active");
106
 
107
+ $("#mysticky_class_selector,#myfixed_disable_small_screen,#myfixed_disable_large_screen,#mysticky_active_on_height,#mysticky_active_on_height_home,#myfixed_fade").parent().parent().parent().hide();
108
  $("#myfixed_zindex,#myfixed_opacity,#myfixed_transition_time,#disable_css").parent().parent().parent().hide();
109
  $("#myfixed_cssstyle").parent().parent().hide();
110
  $("#myfixed_bgcolor").parent().parent().parent().parent().parent().parent().hide();
324
  'my-stickymenu-settings',
325
  'setting_section_id'
326
  );
327
+ add_settings_field(
328
+ 'myfixed_disable_large_screen',
329
+ __("Disable at Large Screen Sizes", 'mystickymenu'),
330
+ array( $this, 'myfixed_disable_large_screen_callback' ),
331
+ 'my-stickymenu-settings',
332
+ 'setting_section_id'
333
+ );
334
  add_settings_field(
335
  'mysticky_active_on_height',
336
  __("Make visible on Scroll", 'mystickymenu'),
461
 
462
  if( isset( $input['myfixed_disable_small_screen'] ) )
463
  $new_input['myfixed_disable_small_screen'] = absint( $input['myfixed_disable_small_screen'] );
464
+
465
+ if( isset( $input['myfixed_disable_large_screen'] ) )
466
+ $new_input['myfixed_disable_large_screen'] = absint( $input['myfixed_disable_large_screen'] );
467
 
468
  if( isset( $input['mysticky_active_on_height'] ) )
469
  $new_input['mysticky_active_on_height'] = absint( $input['mysticky_active_on_height'] );
534
  'myfixed_opacity' => '90',
535
  'myfixed_transition_time' => '0.3',
536
  'myfixed_disable_small_screen' => '0',
537
+ 'myfixed_disable_large_screen' => '0',
538
  'mysticky_active_on_height' => '0',
539
  'mysticky_active_on_height_home' => '0',
540
  'myfixed_fade' => 'on',
627
  echo __("px width, 0 to disable.", 'mystickymenu');
628
  echo '</p>';
629
  }
630
+
631
+
632
+
633
+ public function myfixed_disable_large_screen_callback()
634
+ {
635
+ printf(
636
+ '<p class="description">'
637
+ );
638
+ echo __("more than", 'mystickymenu');
639
+ printf(
640
+ ' <input type="number" class="small-text" min="0" step="1" id="myfixed_disable_large_screen" name="mysticky_option_name[myfixed_disable_large_screen]" value="%s" />',
641
+ isset( $this->options['myfixed_disable_large_screen'] ) ? esc_attr( $this->options['myfixed_disable_large_screen']) : ''
642
+ );
643
+ echo __("px width, 0 to disable.", 'mystickymenu');
644
+ echo '</p>';
645
+ }
646
+
647
+
648
 
649
  public function mysticky_active_on_height_callback()
650
  {
938
 
939
  $myfixed_disable_scroll_down = isset($mysticky_options['myfixed_disable_scroll_down']) ? $mysticky_options['myfixed_disable_scroll_down'] : 'false';
940
  $mystickyTransition = isset($mysticky_options['myfixed_fade']) ? $mysticky_options['myfixed_fade'] : 'fade';
941
+ $mystickyDisableLarge = isset($mysticky_options['myfixed_disable_large_screen']) ? $mysticky_options['myfixed_disable_large_screen'] : '0';
942
 
943
  $mysticky_translation_array = array(
944
  'mystickyClass' => $mysticky_options['mysticky_class_selector'] ,
945
  'activationHeight' => $mysticky_options['mysticky_active_on_height'],
946
  'disableWidth' => $mysticky_options['myfixed_disable_small_screen'],
947
+ 'disableLargeWidth' => $mystickyDisableLarge,
948
  'adminBar' => $top,
949
  'mystickyTransition' => $mystickyTransition,
950
  'mysticky_disable_down' => $myfixed_disable_scroll_down,
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.9.3
7
- Stable tag: 2.0.3
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,8 @@ In some cases you can use the whole header div and than just style it different
54
 
55
 
56
  == Changelog ==
 
 
57
  = 2.0.3 =
58
  * Fixed: Missing bg color field
59
  = 2.0.1 =
4
  Tags: sticky, menu, header, sticky menu, sticky header, floating, floating menu
5
  Requires at least: 3.5.1
6
  Tested up to: 4.9.3
7
+ Stable tag: 2.0.4
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.4 =
58
+ * Added: Hide for large screens
59
  = 2.0.3 =
60
  * Fixed: Missing bg color field
61
  = 2.0.1 =