myStickymenu - Version 2.2.4

Version Description

Smoother transition when the sticky menu disappears

Download this release

Release Info

Developer galdub
Plugin Icon 128x128 myStickymenu
Version 2.2.4
Comparing to
See all releases

Code changes from version 2.2.3 to 2.2.4

js/mystickymenu.js CHANGED
@@ -7,524 +7,423 @@
7
  "use strict";
8
 
9
  $(document).ready(function($){
10
-
11
  if ( jQuery.browser.mobile && !option.device_mobile) {
12
  return false;
13
  } else if ( !jQuery.browser.mobile && !option.device_desktop) {
14
  return false;
15
  }
16
-
17
  // get Sticky Class setting if class name existts
18
  if ($(option.mystickyClass) [0]){
19
  // Do nothing
20
- }
21
- else {
22
  // Do something if class does not exist and stop
23
  console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ");
24
  return;
25
  }
26
-
27
-
28
  // Get class name
29
  var mystickyClass = document.querySelector(option.mystickyClass);
30
-
31
- // get disable at small screen size setting
32
  var disableWidth = parseInt(option.disableWidth);
33
-
34
- // get disable at large screen size setting
35
  var disableLargeWidth = parseInt(option.disableLargeWidth);
36
-
37
- // get body width
38
- //var bodyWidth = parseInt(document.body.clientWidth);
39
-
40
  // get transition effect (slide or fade)
41
  var mystickyTransition = option.mystickyTransition;
42
-
43
  // get activaton height setting
44
  var activationHeight = parseInt(option.activationHeight);
45
-
46
  // if is admin bar showing, needed for auto calc of activation height when admin bar is showing
47
  var adminBar = option.adminBar;
48
 
49
- // disable on scroll down
50
  var mysticky_disable_down = option.mysticky_disable_down;
51
-
52
 
53
-
54
-
55
- var viewportWidth;
56
-
57
-
58
  function calcViewportWidth(e){
59
-
60
  // Calculate actual viewport width
61
- var e = window, a = 'inner';
62
-
63
  if (!('innerWidth' in window )) {
64
  a = 'client';
65
  e = document.documentElement || document.body;
66
  }
67
  viewportWidth = e[ a+'Width' ];
68
-
69
-
70
  }
71
-
72
-
73
  calcViewportWidth();
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
- var parentmysticky = mystickyClass.parentNode;
83
-
84
- var wrappermysticky = document.createElement('div');
85
- var position = 0;
86
- for(var i = 0; i < parentmysticky.childNodes.length; i++) {
87
- if(parentmysticky.childNodes[i] == mystickyClass) {
88
- position = i;
89
- break;
90
- }
91
- }
92
-
93
- wrappermysticky.id = 'mysticky-wrap';
94
- wrappermysticky.appendChild(mystickyClass);
95
- parentmysticky.insertBefore(wrappermysticky, parentmysticky.childNodes[position]);
96
-
97
- var parentnav = mystickyClass.parentNode;
98
- var wrappernav = document.createElement('div');
99
- wrappernav.id = 'mysticky-nav';
100
- parentnav.replaceChild(wrappernav, mystickyClass);
101
- wrappernav.appendChild(mystickyClass);
102
-
103
-
104
-
105
-
106
- // get activation height from settings
107
- if ( activationHeight == "0" ) {
108
- var autoActivate = true;
109
  }
110
-
111
-
112
-
113
-
114
-
115
- var mydivHeight;
116
-
117
-
118
- function initialDivHeight(){
119
-
120
-
121
-
122
- // get initial element height of selected sticky class
123
- mydivHeight = (mystickyClass.offsetHeight);
124
-
125
-
126
-
127
- // when initial element have margin bottom - awaken example using #masthead class
128
-
129
- if (parseInt($(mystickyClass).css("marginBottom")) > 0) {
130
-
131
- // element have margin bottom, apply it to initial wrap
132
- //$(mystickyClass).css("marginBottom").replace('px', '')
133
- wrappermysticky.style.marginBottom = ($(mystickyClass).css("marginBottom"));
134
- }
135
-
136
-
137
- if (mydivHeight == "0") {
138
- // something is wrong, wrapper cant be zero, if so content will jump while scroll. Awaken theme (for example) with .awaken-navigation-container class selected will use this part. Calculate height based on element children height
139
-
140
- $(mystickyClass).children().filter(':visible').each(function(){
141
- mydivHeight = $(this).outerHeight(true);
142
-
143
- });
144
-
145
- }
146
-
147
- if (viewportWidth >= disableWidth) {
148
- //wrappermysticky.style.height = mydivHeight + 'px';
149
- }
 
 
 
 
 
150
  }
151
-
152
- initialDivHeight();
153
-
154
-
155
-
156
-
157
- var myfixedHeight;
158
-
159
- function fixedDivHeight(){
160
  //if ( autoActivate == true ) {
161
-
162
- // calculate element height while fixed
163
-
164
- mystickyClass.classList.add('myfixed')
165
-
166
- myfixedHeight = $(".myfixed").outerHeight();
167
-
168
- if (myfixedHeight == "0") {
169
- // something is wrong, wrapper cant be zero, try to calculate again with div children.
170
- $(".myfixed").children().filter(':visible').each(function(){
171
- myfixedHeight = $(this).outerHeight(true);
172
- });
173
- }
174
-
175
- mystickyClass.classList.remove('myfixed');
176
-
177
- //}
178
-
179
  }
180
-
181
- fixedDivHeight();
182
-
183
-
184
-
185
-
186
- var adminBarHeight = 0;
187
-
 
 
 
188
  function calcAdminBarHeight(){
189
-
190
-
191
-
192
-
193
- if ((adminBar == "true" ) && (viewportWidth > 600)) {
194
-
195
- if ($("#wpadminbar")[0]){
196
-
197
- adminBarHeight = $('#wpadminbar').height();
198
-
199
  } else {
200
-
201
  adminBarHeight = 0;
202
-
203
  }
204
-
205
-
206
-
207
- } else {
208
-
209
- adminBarHeight = 0;
210
- }
211
-
212
-
213
- //wrappernav.style.top = adminBarHeight + "px";
214
-
215
- if (mystickyTransition == "on") {
216
-
217
- wrappernav.style.top = "-" + myfixedHeight + "px";
218
- //wrappernav.style.top = "-" + myfixedHeight + "px";
219
-
220
- } else {
221
- wrappernav.style.top = adminBarHeight + "px";
222
-
223
  }
224
-
225
  }
226
-
227
-
228
-
229
  calcAdminBarHeight();
230
-
231
-
232
-
233
-
234
-
235
-
236
- var mydivWidth;
237
-
238
-
239
- function initialDivWidth(){
240
-
241
  var rect = $(mystickyClass)[0].getBoundingClientRect();
242
  mydivWidth = rect.width;
243
-
244
  //var mydivWidth = ((mystickyClass.offsetWidth) + 'px');
245
  //mystickyClass.style.width = mydivWidth + "px";
246
-
247
-
248
- }
249
-
250
- initialDivWidth();
251
-
252
-
253
-
254
-
255
- var deactivationHeight = activationHeight;
256
-
257
- function calcActivationHeight() {
258
-
259
- // If activate height (Make visible on Scroll) is set to 0, automatic calculation will be used.
260
- if ( autoActivate == true ) {
261
-
262
- // Automatic calculation of activation and deactivation height (Make visible on Scroll is set to 0).
263
- if (mystickyTransition == "on") {
264
- // Slide effect is selected
265
- //activationHeight = $(mystickyClass).offset().top + mystickyClass.offsetHeight - adminBarHeight;
266
- activationHeight = $(mystickyClass).offset().top + mydivHeight - adminBarHeight;
267
- deactivationHeight = $(mystickyClass).offset().top + mydivHeight - adminBarHeight;
268
- //deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
269
-
270
- if (mysticky_disable_down == "on") {
271
- deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
272
-
273
- }
274
-
275
- }
276
-
277
- if (mystickyTransition == "fade") {
278
-
279
- if (mysticky_disable_down == "false") {
280
- // Fade effect is selected
281
- activationHeight = $(mystickyClass).offset().top - adminBarHeight;
282
-
283
- deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
284
-
285
- }
286
-
287
- if (mysticky_disable_down == "on") {
288
-
289
- // Fade effect is selected
290
- activationHeight = $(mystickyClass).offset().top - adminBarHeight + mydivHeight;
291
  deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
292
-
293
- }
294
-
295
  }
296
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  }
298
-
299
  }
300
 
301
- calcActivationHeight();
302
-
303
-
304
-
305
-
306
-
307
-
308
- function headerDeactivateOnHeight() {
309
-
310
-
311
- if ( autoActivate == true ) {
312
-
313
- if ( mydivHeight > myfixedHeight ){
314
- // Auto activate is true, Make visible on Scroll is set to 0, menu is probably header
315
-
316
-
317
-
318
- if (mystickyTransition == "on") {
319
- // slide effect is selected
320
- deactivationHeight = activationHeight;
321
-
322
- if (mysticky_disable_down == "on") {
323
- deactivationHeight = activationHeight - myfixedHeight;
324
-
325
- }
326
-
327
-
328
- } else {
329
- activationHeight = mydivHeight;
330
- deactivationHeight = mydivHeight;
331
-
332
  }
333
-
 
 
 
 
 
334
  }
335
-
336
  }
337
-
338
- }
339
-
340
- headerDeactivateOnHeight();
341
-
342
-
343
-
344
- var hasScrollY = 'scrollY' in window;
345
- var lastScrollTop = 0;
346
-
347
-
348
- function onScroll(e) {
349
-
350
-
351
- //initialDivHeight();
352
-
353
- // if body width is larger than disable at small screen size setting
354
-
355
-
356
-
357
-
358
- if (viewportWidth >= disableWidth) {
359
-
360
-
361
-
362
  if ( disableLargeWidth == 0 || viewportWidth <= disableLargeWidth ) {
363
-
364
-
365
-
366
- //if (mysticky_disable_down == "on") {
367
-
368
- var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
369
-
370
-
371
-
372
- //var yScrollPosition = $(this).scrollTop();
373
-
374
-
375
- // add up or down class to the element depending on scroll direction
376
- if (0 <= y ) {
377
-
378
- //var st = $(this).scrollTop();
379
-
380
-
381
- if (y >= lastScrollTop){
382
-
383
- // downscroll code
384
-
385
-
386
-
387
-
388
- // add myfixed and wrapfixed class to selected fixed element while scroll down
389
- y >= activationHeight ? mystickyClass.classList.add('myfixed') : "";
390
- y >= activationHeight ? wrappernav.classList.add('wrapfixed') : "";
391
-
392
- y >= activationHeight ? wrappermysticky.style.height = mydivHeight + 'px' : "";
393
- y >= activationHeight ? mystickyClass.style.width = mydivWidth + "px" : "";
394
-
395
-
396
- if (mystickyTransition == "on") {
397
-
398
- if (mysticky_disable_down == "false") {
399
- //y < activationHeight + (myfixedHeight + 250) - adminBarHeight ? wrappernav.style.top = "-" + myfixedHeight + "px" : '';
400
- //wrappernav.style.top = "-" + myfixedHeight + "px"
401
- y >= activationHeight + myfixedHeight - adminBarHeight ? wrappernav.style.top = adminBarHeight + "px" : wrappernav.style.top = "-" + myfixedHeight + "px";
402
-
403
- }
404
-
405
- if ( mydivHeight > myfixedHeight ){
406
- // if it's header (guess)
407
-
408
- if (mysticky_disable_down == "false") {
409
-
410
- y < activationHeight + myfixedHeight ? wrappernav.style.top = "-" + mydivHeight + "px" : '';
411
- y >= activationHeight + myfixedHeight ? wrappernav.style.top = adminBarHeight + "px" : '';
412
-
413
  }
414
-
415
  }
416
-
417
- }
418
-
419
- wrappernav.classList.add('down');
420
- wrappernav.classList.remove('up');
421
-
422
-
423
- if (mysticky_disable_down == "on") {
424
- wrappernav.style.top = "-" + (mydivHeight + adminBarHeight ) + "px";
425
- jQuery('#mysticky-nav ' + option.mystickyClass+'.elementor-sticky').hide();
426
- //jQuery('#mysticky-nav ' + option.mystickyClass).css( 'top' , "-" + (mydivHeight + adminBarHeight ) + "px");
427
- }
428
-
429
-
430
-
431
-
432
- } else {
433
- // upscroll code
434
-
435
-
436
- var x = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
437
- //x > deactivationHeight ? '' : mystickyClass.classList.remove('myfixed') ;
438
- //x > deactivationHeight ? '' : wrappernav.classList.remove('wrapfixed');
439
-
440
- x > deactivationHeight ? "" : wrappermysticky.style.height = "";
441
- x > deactivationHeight ? "" : mystickyClass.style.width = "";
442
-
443
- if (mystickyTransition == "on") {
444
-
445
-
446
-
447
  x > deactivationHeight ? '' : mystickyClass.classList.remove('myfixed') ;
448
  x > deactivationHeight ? '' : wrappernav.classList.remove('wrapfixed');
449
-
450
- if (mysticky_disable_down == "false") {
451
-
452
- x < deactivationHeight + myfixedHeight + 200 - adminBarHeight ? wrappernav.style.top = "-" + myfixedHeight + "px" : '';
453
-
454
- }
455
-
456
- } else {
457
-
458
- x > deactivationHeight ? "" : mystickyClass.classList.remove('myfixed') ;
459
- x > deactivationHeight ? "" : wrappernav.classList.remove('wrapfixed');
460
-
461
-
462
- }
463
-
464
-
465
- wrappernav.classList.remove('down');
466
- wrappernav.classList.add('up');
467
-
468
- if (mysticky_disable_down == "on") {
469
- wrappernav.style.top = adminBarHeight + "px";
470
- jQuery('#mysticky-nav '+ option.mystickyClass).css( 'width' , mydivWidth + "px");
471
- jQuery('#mysticky-nav ' + option.mystickyClass+'.elementor-sticky').show();
472
-
473
  }
474
-
475
- }
476
 
477
- lastScrollTop = y;
478
-
479
- } else {
480
- //if (mysticky_disable_down == "on") {
481
- wrappernav.classList.remove('up');
482
- //}
483
- }
484
-
485
-
486
- } // if disableWidth is greater than zero
487
-
488
-
489
  } // if disableLargeWidth is 0 or greater than zero
490
-
491
-
492
-
493
-
494
- }
495
 
496
- document.addEventListener('scroll', onScroll);
497
-
498
-
499
-
500
-
501
  var width = $(window).width()
502
-
503
  function OnResizeDocument () {
504
-
505
 
506
- // don't recalculate on height change, only width
507
  if($(window).width() != width ){
508
-
509
 
510
  wrappernav.classList.remove('up');
511
  wrappernav.classList.remove('down');
512
-
513
  if ($(".wrapfixed")[0]){
514
  // If class wrapfixed exists
515
- // Remove myfixed and wrapfixed clases so we can calculate
516
  mystickyClass.classList.remove('myfixed');
517
  wrappernav.classList.remove('wrapfixed');
518
-
519
-
520
-
521
  } else {
522
  // Else class wrapfixed does not exists
523
  initialDivHeight();
524
-
525
  // Remove width
526
  mystickyClass.style.removeProperty("width");
527
- initialDivWidth();
528
 
529
  }
530
  calcViewportWidth();
@@ -532,20 +431,15 @@
532
  fixedDivHeight();
533
  calcActivationHeight();
534
  headerDeactivateOnHeight();
535
-
536
- }
537
-
538
  }
539
-
540
  window.addEventListener('resize', OnResizeDocument);
541
-
542
  // need to test this, it should fire script on mobile orientation change, since onresize is somehow faulty in this case
543
  window.addEventListener('orientationchange', OnResizeDocument);
544
-
545
-
546
-
547
 
548
  });
549
 
550
-
551
  })(jQuery);
7
  "use strict";
8
 
9
  $(document).ready(function($){
10
+
11
  if ( jQuery.browser.mobile && !option.device_mobile) {
12
  return false;
13
  } else if ( !jQuery.browser.mobile && !option.device_desktop) {
14
  return false;
15
  }
16
+
17
  // get Sticky Class setting if class name existts
18
  if ($(option.mystickyClass) [0]){
19
  // Do nothing
20
+ } else {
 
21
  // Do something if class does not exist and stop
22
  console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ");
23
  return;
24
  }
25
+
26
+
27
  // Get class name
28
  var mystickyClass = document.querySelector(option.mystickyClass);
29
+
30
+ // get disable at small screen size setting
31
  var disableWidth = parseInt(option.disableWidth);
32
+
33
+ // get disable at large screen size setting
34
  var disableLargeWidth = parseInt(option.disableLargeWidth);
35
+
 
 
 
36
  // get transition effect (slide or fade)
37
  var mystickyTransition = option.mystickyTransition;
38
+
39
  // get activaton height setting
40
  var activationHeight = parseInt(option.activationHeight);
41
+
42
  // if is admin bar showing, needed for auto calc of activation height when admin bar is showing
43
  var adminBar = option.adminBar;
44
 
45
+ // disable on scroll down
46
  var mysticky_disable_down = option.mysticky_disable_down;
 
47
 
48
+ var viewportWidth;
49
+
 
 
 
50
  function calcViewportWidth(e){
51
+
52
  // Calculate actual viewport width
53
+ var e = window, a = 'inner';
54
+
55
  if (!('innerWidth' in window )) {
56
  a = 'client';
57
  e = document.documentElement || document.body;
58
  }
59
  viewportWidth = e[ a+'Width' ];
60
+
 
61
  }
62
+
 
63
  calcViewportWidth();
64
+
65
+ var parentmysticky = mystickyClass.parentNode;
66
+
67
+ var wrappermysticky = document.createElement('div');
68
+ var position = 0;
69
+ for(var i = 0; i < parentmysticky.childNodes.length; i++) {
70
+ if(parentmysticky.childNodes[i] == mystickyClass) {
71
+ position = i;
72
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
+ }
75
+
76
+ wrappermysticky.id = 'mysticky-wrap';
77
+ wrappermysticky.appendChild(mystickyClass);
78
+ parentmysticky.insertBefore(wrappermysticky, parentmysticky.childNodes[position]);
79
+
80
+ var parentnav = mystickyClass.parentNode;
81
+ var wrappernav = document.createElement('div');
82
+ wrappernav.id = 'mysticky-nav';
83
+ parentnav.replaceChild(wrappernav, mystickyClass);
84
+ wrappernav.appendChild(mystickyClass);
85
+
86
+ // get activation height from settings
87
+ if ( activationHeight == "0" ) {
88
+ var autoActivate = true;
89
+ }
90
+
91
+ var mydivHeight;
92
+
93
+
94
+ function initialDivHeight(){
95
+
96
+ // get initial element height of selected sticky class
97
+ mydivHeight = (mystickyClass.offsetHeight);
98
+
99
+ // when initial element have margin bottom - awaken example using #masthead class
100
+ if (parseInt($(mystickyClass).css("marginBottom")) > 0) {
101
+
102
+ // element have margin bottom, apply it to initial wrap
103
+ //$(mystickyClass).css("marginBottom").replace('px', '')
104
+ wrappermysticky.style.marginBottom = ($(mystickyClass).css("marginBottom"));
105
+ }
106
+
107
+ if (mydivHeight == "0") {
108
+ // something is wrong, wrapper cant be zero, if so content will jump while scroll. Awaken theme (for example) with .awaken-navigation-container class selected will use this part. Calculate height based on element children height
109
+
110
+ $(mystickyClass).children().filter(':visible').each(function(){
111
+ mydivHeight = $(this).outerHeight(true);
112
+
113
+ });
114
+
115
+ }
116
+
117
+ if (viewportWidth >= disableWidth) {
118
+ //wrappermysticky.style.height = mydivHeight + 'px';
119
  }
120
+ }
121
+
122
+ initialDivHeight();
123
+
124
+ var myfixedHeight;
125
+
126
+ function fixedDivHeight(){
 
 
127
  //if ( autoActivate == true ) {
128
+
129
+ // calculate element height while fixed
130
+ mystickyClass.classList.add('myfixed')
131
+
132
+ myfixedHeight = $(".myfixed").outerHeight();
133
+
134
+ if (myfixedHeight == "0") {
135
+ // something is wrong, wrapper cant be zero, try to calculate again with div children.
136
+ $(".myfixed").children().filter(':visible').each(function(){
137
+ myfixedHeight = $(this).outerHeight(true);
138
+ });
 
 
 
 
 
 
 
139
  }
140
+
141
+ mystickyClass.classList.remove('myfixed');
142
+
143
+ //}
144
+
145
+ }
146
+
147
+ fixedDivHeight();
148
+
149
+ var adminBarHeight = 0;
150
+
151
  function calcAdminBarHeight(){
152
+
153
+ if ((adminBar == "true" ) && (viewportWidth > 600)) {
154
+
155
+ if ($("#wpadminbar")[0]){
156
+ adminBarHeight = $('#wpadminbar').height();
157
+ } else {
158
+ adminBarHeight = 0;
159
+ }
 
 
160
  } else {
 
161
  adminBarHeight = 0;
 
162
  }
163
+
164
+
165
+ //wrappernav.style.top = adminBarHeight + "px";
166
+ if (mystickyTransition == "slide") {
167
+ wrappernav.style.top = "-" + myfixedHeight + "px";
168
+ //wrappernav.style.top = "-" + myfixedHeight + "px";
169
+ } else {
170
+ wrappernav.style.top = adminBarHeight + "px";
 
 
 
 
 
 
 
 
 
 
 
171
  }
172
+
173
  }
174
+
 
 
175
  calcAdminBarHeight();
176
+
177
+
178
+ var mydivWidth;
179
+
180
+ function initialDivWidth(){
181
+
 
 
 
 
 
182
  var rect = $(mystickyClass)[0].getBoundingClientRect();
183
  mydivWidth = rect.width;
184
+
185
  //var mydivWidth = ((mystickyClass.offsetWidth) + 'px');
186
  //mystickyClass.style.width = mydivWidth + "px";
187
+
188
+ }
189
+
190
+ initialDivWidth();
191
+
192
+
193
+
194
+
195
+ var deactivationHeight = activationHeight;
196
+
197
+ function calcActivationHeight() {
198
+
199
+ // If activate height (Make visible on Scroll) is set to 0, automatic calculation will be used.
200
+ if ( autoActivate == true ) {
201
+
202
+ // Automatic calculation of activation and deactivation height (Make visible on Scroll is set to 0).
203
+ if (mystickyTransition == "slide") {
204
+ // Slide effect is selected
205
+ //activationHeight = $(mystickyClass).offset().top + mystickyClass.offsetHeight - adminBarHeight;
206
+ activationHeight = $(mystickyClass).offset().top + mydivHeight - adminBarHeight;
207
+ deactivationHeight = $(mystickyClass).offset().top + mydivHeight - adminBarHeight;
208
+ //deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
209
+
210
+ if (mysticky_disable_down == "on") {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
212
+
 
 
213
  }
214
+
215
+ }
216
+
217
+ if (mystickyTransition == "fade") {
218
+
219
+ if (mysticky_disable_down == "false") {
220
+ // Fade effect is selected
221
+ activationHeight = $(mystickyClass).offset().top - adminBarHeight;
222
+
223
+ deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
224
+
225
+ }
226
+
227
+ if (mysticky_disable_down == "on") {
228
+
229
+ // Fade effect is selected
230
+ activationHeight = $(mystickyClass).offset().top - adminBarHeight + mydivHeight;
231
+ deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
232
+
233
+ }
234
+
235
  }
236
+
237
  }
238
 
239
+ }
240
+
241
+ calcActivationHeight();
242
+
243
+ function headerDeactivateOnHeight() {
244
+
245
+
246
+ if ( autoActivate == true ) {
247
+
248
+ if ( mydivHeight > myfixedHeight ){
249
+ // Auto activate is true, Make visible on Scroll is set to 0, menu is probably header
250
+
251
+
252
+
253
+ if (mystickyTransition == "slide") {
254
+ // slide effect is selected
255
+ deactivationHeight = activationHeight;
256
+
257
+ if (mysticky_disable_down == "on") {
258
+ deactivationHeight = activationHeight - myfixedHeight;
259
+
 
 
 
 
 
 
 
 
 
 
260
  }
261
+
262
+
263
+ } else {
264
+ activationHeight = mydivHeight;
265
+ deactivationHeight = mydivHeight;
266
+
267
  }
268
+
269
  }
270
+
271
+ }
272
+
273
+ }
274
+
275
+ headerDeactivateOnHeight();
276
+
277
+
278
+ var hasScrollY = 'scrollY' in window;
279
+ var lastScrollTop = 0;
280
+
281
+ function onScroll(e) {
282
+
283
+ //initialDivHeight();
284
+ // if body width is larger than disable at small screen size setting
285
+
286
+ if (viewportWidth >= disableWidth) {
287
+
 
 
 
 
 
 
 
288
  if ( disableLargeWidth == 0 || viewportWidth <= disableLargeWidth ) {
289
+
290
+ //if (mysticky_disable_down == "on") {
291
+
292
+ var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
293
+
294
+ //var yScrollPosition = $(this).scrollTop();
295
+
296
+ // add up or down class to the element depending on scroll direction
297
+ if (0 <= y ) {
298
+
299
+ //var st = $(this).scrollTop();
300
+
301
+ if (y >= lastScrollTop){
302
+
303
+ // downscroll code
304
+
305
+ // add myfixed and wrapfixed class to selected fixed element while scroll down
306
+ y >= activationHeight ? mystickyClass.classList.add('myfixed') : "";
307
+ y >= activationHeight ? wrappernav.classList.add('wrapfixed') : "";
308
+
309
+ y >= activationHeight ? wrappermysticky.style.height = mydivHeight + 'px' : "";
310
+ y >= activationHeight ? mystickyClass.style.width = mydivWidth + "px" : "";
311
+
312
+
313
+ if (mystickyTransition == "slide") {
314
+
315
+ if (mysticky_disable_down == "false") {
316
+ //y < activationHeight + (myfixedHeight + 250) - adminBarHeight ? wrappernav.style.top = "-" + myfixedHeight + "px" : '';
317
+ //wrappernav.style.top = "-" + myfixedHeight + "px"
318
+ y >= activationHeight + myfixedHeight - adminBarHeight ? wrappernav.style.top = adminBarHeight + "px" : wrappernav.style.top = "-" + myfixedHeight + "px";
319
+
320
+ }
321
+
322
+ if ( mydivHeight > myfixedHeight ){
323
+ // if it's header (guess)
324
+
325
+ if (mysticky_disable_down == "false") {
326
+
327
+ y < activationHeight + myfixedHeight ? wrappernav.style.top = "-" + mydivHeight + "px" : '';
328
+ y >= activationHeight + myfixedHeight ? wrappernav.style.top = adminBarHeight + "px" : '';
329
+
330
+ }
331
+
 
 
 
 
 
 
 
332
  }
333
+
334
  }
335
+
336
+ wrappernav.classList.add('down');
337
+ wrappernav.classList.remove('up');
338
+
339
+
340
+ if (mysticky_disable_down == "on") {
341
+ wrappernav.style.top = "-" + (mydivHeight + adminBarHeight ) + "px";
342
+ jQuery('#mysticky-nav ' + option.mystickyClass+'.elementor-sticky').hide();
343
+ //jQuery('#mysticky-nav ' + option.mystickyClass).css( 'top' , "-" + (mydivHeight + adminBarHeight ) + "px");
344
+ }
345
+
346
+ } else {
347
+ // upscroll code
348
+
349
+ var x = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
350
+ //x > deactivationHeight ? '' : mystickyClass.classList.remove('myfixed') ;
351
+ //x > deactivationHeight ? '' : wrappernav.classList.remove('wrapfixed');
352
+
353
+ x > deactivationHeight ? "" : wrappermysticky.style.height = "";
354
+ x > deactivationHeight ? "" : mystickyClass.style.width = "";
355
+
356
+ if (mystickyTransition == "slide") {
357
+
 
 
 
 
 
 
 
 
358
  x > deactivationHeight ? '' : mystickyClass.classList.remove('myfixed') ;
359
  x > deactivationHeight ? '' : wrappernav.classList.remove('wrapfixed');
360
+
361
+ if (mysticky_disable_down == "false") {
362
+
363
+ x < deactivationHeight + myfixedHeight + 200 - adminBarHeight ? wrappernav.style.top = "-" + myfixedHeight + "px" : '';
364
+ }
365
+
366
+ } else {
367
+
368
+ x > deactivationHeight ? "" : mystickyClass.classList.remove('myfixed') ;
369
+ x > deactivationHeight ? "" : wrappernav.classList.remove('wrapfixed');
370
+
371
+ }
372
+
373
+
374
+ wrappernav.classList.remove('down');
375
+ wrappernav.classList.add('up');
376
+
377
+ if (mysticky_disable_down == "on") {
378
+ wrappernav.style.top = adminBarHeight + "px";
379
+ jQuery('#mysticky-nav '+ option.mystickyClass).css( 'width' , mydivWidth + "px");
380
+ jQuery('#mysticky-nav ' + option.mystickyClass+'.elementor-sticky').show();
381
+
382
+ }
383
+
384
  }
 
 
385
 
386
+ lastScrollTop = y;
387
+
388
+ } else {
389
+ //if (mysticky_disable_down == "on") {
390
+ wrappernav.classList.remove('up');
391
+ //}
392
+ }
393
+
394
+ } // if disableWidth is greater than zero
395
+
396
+
 
397
  } // if disableLargeWidth is 0 or greater than zero
 
 
 
 
 
398
 
399
+ }
400
+
401
+ document.addEventListener('scroll', onScroll);
402
+
403
+
404
  var width = $(window).width()
405
+
406
  function OnResizeDocument () {
 
407
 
408
+ // don't recalculate on height change, only width
409
  if($(window).width() != width ){
 
410
 
411
  wrappernav.classList.remove('up');
412
  wrappernav.classList.remove('down');
413
+
414
  if ($(".wrapfixed")[0]){
415
  // If class wrapfixed exists
416
+ // Remove myfixed and wrapfixed clases so we can calculate
417
  mystickyClass.classList.remove('myfixed');
418
  wrappernav.classList.remove('wrapfixed');
419
+
 
 
420
  } else {
421
  // Else class wrapfixed does not exists
422
  initialDivHeight();
423
+
424
  // Remove width
425
  mystickyClass.style.removeProperty("width");
426
+ initialDivWidth();
427
 
428
  }
429
  calcViewportWidth();
431
  fixedDivHeight();
432
  calcActivationHeight();
433
  headerDeactivateOnHeight();
434
+
435
+ }
436
+
437
  }
438
+
439
  window.addEventListener('resize', OnResizeDocument);
 
440
  // need to test this, it should fire script on mobile orientation change, since onresize is somehow faulty in this case
441
  window.addEventListener('orientationchange', OnResizeDocument);
 
 
 
442
 
443
  });
444
 
 
445
  })(jQuery);
js/mystickymenu.min.js CHANGED
@@ -1 +1,28 @@
1
- !function(e){"use strict";jQuery(document).ready(function(e){if(jQuery.browser.mobile&&!option.device_mobile)return!1;if(!jQuery.browser.mobile&&!option.device_desktop)return!1;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),r=option.adminBar,a=option.mysticky_disable_down;C();for(var c=i.parentNode,l=document.createElement("div"),m=0,p=0;p<c.childNodes.length;p++)if(c.childNodes[p]==i){m=p;break}l.id="mysticky-wrap",l.appendChild(i),c.insertBefore(l,c.childNodes[m]);var y,f,u=i.parentNode,h=document.createElement("div");if(h.id="mysticky-nav",u.replaceChild(h,i),h.appendChild(i),"0"==d)var w=!0;E(),j();var v,x=0;B(),Q();var L=d;S(),H();var k="scrollY"in window,g=0;document.addEventListener("scroll",function(e){if(t>=o&&(0==s||t<=s)){var r=k?window.scrollY:document.documentElement.scrollTop;if(0<=r){if(r>=g)r>=d&&i.classList.add("myfixed"),r>=d&&h.classList.add("wrapfixed"),r>=d&&(l.style.height=y+"px"),r>=d&&(i.style.width=v+"px"),"on"==n&&("false"==a&&(h.style.top=r>=d+f-x?x+"px":"-"+f+"px"),y>f&&"false"==a&&(r<d+f&&(h.style.top="-"+y+"px"),r>=d+f&&(h.style.top=x+"px"))),h.classList.add("down"),h.classList.remove("up"),"on"==a&&(h.style.top="-"+(y+x)+"px",jQuery("#mysticky-nav "+option.mystickyClass+".elementor-sticky").hide());else{var c=k?window.scrollY:document.documentElement.scrollTop;!(c>L)&&(l.style.height=""),!(c>L)&&(i.style.width=""),"on"==n?(!(c>L)&&i.classList.remove("myfixed"),!(c>L)&&h.classList.remove("wrapfixed"),"false"==a&&c<L+f+200-x&&(h.style.top="-"+f+"px")):(!(c>L)&&i.classList.remove("myfixed"),!(c>L)&&h.classList.remove("wrapfixed")),h.classList.remove("down"),h.classList.add("up"),"on"==a&&(h.style.top=x+"px",jQuery("#mysticky-nav "+option.mystickyClass).css("width",v+"px"),jQuery("#mysticky-nav "+option.mystickyClass+".elementor-sticky").show())}g=r}else h.classList.remove("up")}});var b=e(window).width();window.addEventListener("resize",N),window.addEventListener("orientationchange",N)}else console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ");function C(e){e=window;var i="inner";"innerWidth"in window||(i="client",e=document.documentElement||document.body),t=e[i+"Width"]}function E(){y=i.offsetHeight,parseInt(e(i).css("marginBottom"))>0&&(l.style.marginBottom=e(i).css("marginBottom")),"0"==y&&e(i).children().filter(":visible").each(function(){y=e(this).outerHeight(!0)})}function j(){i.classList.add("myfixed"),"0"==(f=e(".myfixed").outerHeight())&&e(".myfixed").children().filter(":visible").each(function(){f=e(this).outerHeight(!0)}),i.classList.remove("myfixed")}function B(){x="true"==r&&t>600&&e("#wpadminbar")[0]?e("#wpadminbar").height():0,h.style.top="on"==n?"-"+f+"px":x+"px"}function Q(){var t=e(i)[0].getBoundingClientRect();v=t.width}function S(){1==w&&("on"==n&&(d=e(i).offset().top+y-x,L=e(i).offset().top+y-x,"on"==a&&(L=e(i).offset().top-x)),"fade"==n&&("false"==a&&(d=e(i).offset().top-x,L=e(i).offset().top-x),"on"==a&&(d=e(i).offset().top-x+y,L=e(i).offset().top-x)))}function H(){1==w&&y>f&&("on"==n?(L=d,"on"==a&&(L=d-f)):(d=y,L=y))}function N(){e(window).width()!=b&&(h.classList.remove("up"),h.classList.remove("down"),e(".wrapfixed")[0]?(i.classList.remove("myfixed"),h.classList.remove("wrapfixed")):(E(),i.style.removeProperty("width"),Q()),C(),B(),j(),S(),H())}})}();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){"use strict";$(document).ready(function($){if(jQuery.browser.mobile&&!option.device_mobile){return!1}else if(!jQuery.browser.mobile&&!option.device_desktop){return!1}
2
+ if($(option.mystickyClass)[0]){}else{console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ");return}
3
+ var mystickyClass=document.querySelector(option.mystickyClass);var disableWidth=parseInt(option.disableWidth);var disableLargeWidth=parseInt(option.disableLargeWidth);var mystickyTransition=option.mystickyTransition;var activationHeight=parseInt(option.activationHeight);var adminBar=option.adminBar;var mysticky_disable_down=option.mysticky_disable_down;var viewportWidth;function calcViewportWidth(e){var e=window,a='inner';if(!('innerWidth' in window)){a='client';e=document.documentElement||document.body}
4
+ viewportWidth=e[a+'Width']}
5
+ calcViewportWidth();var parentmysticky=mystickyClass.parentNode;var wrappermysticky=document.createElement('div');var position=0;for(var i=0;i<parentmysticky.childNodes.length;i++){if(parentmysticky.childNodes[i]==mystickyClass){position=i;break}}
6
+ wrappermysticky.id='mysticky-wrap';wrappermysticky.appendChild(mystickyClass);parentmysticky.insertBefore(wrappermysticky,parentmysticky.childNodes[position]);var parentnav=mystickyClass.parentNode;var wrappernav=document.createElement('div');wrappernav.id='mysticky-nav';parentnav.replaceChild(wrappernav,mystickyClass);wrappernav.appendChild(mystickyClass);if(activationHeight=="0"){var autoActivate=!0}
7
+ var mydivHeight;function initialDivHeight(){mydivHeight=(mystickyClass.offsetHeight);if(parseInt($(mystickyClass).css("marginBottom"))>0){wrappermysticky.style.marginBottom=($(mystickyClass).css("marginBottom"))}
8
+ if(mydivHeight=="0"){$(mystickyClass).children().filter(':visible').each(function(){mydivHeight=$(this).outerHeight(!0)})}
9
+ if(viewportWidth>=disableWidth){}}
10
+ initialDivHeight();var myfixedHeight;function fixedDivHeight(){mystickyClass.classList.add('myfixed')
11
+ myfixedHeight=$(".myfixed").outerHeight();if(myfixedHeight=="0"){$(".myfixed").children().filter(':visible').each(function(){myfixedHeight=$(this).outerHeight(!0)})}
12
+ mystickyClass.classList.remove('myfixed')}
13
+ fixedDivHeight();var adminBarHeight=0;function calcAdminBarHeight(){if((adminBar=="true")&&(viewportWidth>600)){if($("#wpadminbar")[0]){adminBarHeight=$('#wpadminbar').height()}else{adminBarHeight=0}}else{adminBarHeight=0}
14
+ if(mystickyTransition=="slide"){wrappernav.style.top="-"+myfixedHeight+"px"}else{wrappernav.style.top=adminBarHeight+"px"}}
15
+ calcAdminBarHeight();var mydivWidth;function initialDivWidth(){var rect=$(mystickyClass)[0].getBoundingClientRect();mydivWidth=rect.width}
16
+ initialDivWidth();var deactivationHeight=activationHeight;function calcActivationHeight(){if(autoActivate==!0){if(mystickyTransition=="slide"){activationHeight=$(mystickyClass).offset().top+mydivHeight-adminBarHeight;deactivationHeight=$(mystickyClass).offset().top+mydivHeight-adminBarHeight;if(mysticky_disable_down=="on"){deactivationHeight=$(mystickyClass).offset().top-adminBarHeight}}
17
+ if(mystickyTransition=="fade"){if(mysticky_disable_down=="false"){activationHeight=$(mystickyClass).offset().top-adminBarHeight;deactivationHeight=$(mystickyClass).offset().top-adminBarHeight}
18
+ if(mysticky_disable_down=="on"){activationHeight=$(mystickyClass).offset().top-adminBarHeight+mydivHeight;deactivationHeight=$(mystickyClass).offset().top-adminBarHeight}}}}
19
+ calcActivationHeight();function headerDeactivateOnHeight(){if(autoActivate==!0){if(mydivHeight>myfixedHeight){if(mystickyTransition=="slide"){deactivationHeight=activationHeight;if(mysticky_disable_down=="on"){deactivationHeight=activationHeight-myfixedHeight}}else{activationHeight=mydivHeight;deactivationHeight=mydivHeight}}}}
20
+ headerDeactivateOnHeight();var hasScrollY='scrollY' in window;var lastScrollTop=0;function onScroll(e){if(viewportWidth>=disableWidth){if(disableLargeWidth==0||viewportWidth<=disableLargeWidth){var y=hasScrollY?window.scrollY:document.documentElement.scrollTop;if(0<=y){if(y>=lastScrollTop){y>=activationHeight?mystickyClass.classList.add('myfixed'):"";y>=activationHeight?wrappernav.classList.add('wrapfixed'):"";y>=activationHeight?wrappermysticky.style.height=mydivHeight+'px':"";y>=activationHeight?mystickyClass.style.width=mydivWidth+"px":"";if(mystickyTransition=="slide"){if(mysticky_disable_down=="false"){y>=activationHeight+myfixedHeight-adminBarHeight?wrappernav.style.top=adminBarHeight+"px":wrappernav.style.top="-"+myfixedHeight+"px"}
21
+ if(mydivHeight>myfixedHeight){if(mysticky_disable_down=="false"){y<activationHeight+myfixedHeight?wrappernav.style.top="-"+mydivHeight+"px":'';y>=activationHeight+myfixedHeight?wrappernav.style.top=adminBarHeight+"px":''}}}
22
+ wrappernav.classList.add('down');wrappernav.classList.remove('up');if(mysticky_disable_down=="on"){wrappernav.style.top="-"+(mydivHeight+adminBarHeight)+"px";jQuery('#mysticky-nav '+option.mystickyClass+'.elementor-sticky').hide()}}else{var x=hasScrollY?window.scrollY:document.documentElement.scrollTop;x>deactivationHeight?"":wrappermysticky.style.height="";x>deactivationHeight?"":mystickyClass.style.width="";if(mystickyTransition=="slide"){x>deactivationHeight?'':mystickyClass.classList.remove('myfixed');x>deactivationHeight?'':wrappernav.classList.remove('wrapfixed');if(mysticky_disable_down=="false"){x<deactivationHeight+myfixedHeight+200-adminBarHeight?wrappernav.style.top="-"+myfixedHeight+"px":''}}else{x>deactivationHeight?"":mystickyClass.classList.remove('myfixed');x>deactivationHeight?"":wrappernav.classList.remove('wrapfixed')}
23
+ wrappernav.classList.remove('down');wrappernav.classList.add('up');if(mysticky_disable_down=="on"){wrappernav.style.top=adminBarHeight+"px";jQuery('#mysticky-nav '+option.mystickyClass).css('width',mydivWidth+"px");jQuery('#mysticky-nav '+option.mystickyClass+'.elementor-sticky').show()}}
24
+ lastScrollTop=y}else{wrappernav.classList.remove('up')}}}}
25
+ document.addEventListener('scroll',onScroll);var width=$(window).width()
26
+ function OnResizeDocument(){if($(window).width()!=width){wrappernav.classList.remove('up');wrappernav.classList.remove('down');if($(".wrapfixed")[0]){mystickyClass.classList.remove('myfixed');wrappernav.classList.remove('wrapfixed')}else{initialDivHeight();mystickyClass.style.removeProperty("width");initialDivWidth()}
27
+ calcViewportWidth();calcAdminBarHeight();fixedDivHeight();calcActivationHeight();headerDeactivateOnHeight()}}
28
+ window.addEventListener('resize',OnResizeDocument);window.addEventListener('orientationchange',OnResizeDocument)})})(jQuery)
mystickymenu-affiliate.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MyStickyMenu_affiliate_program {
3
+
4
+ public $plugin = "mystickymenu";
5
+
6
+ public function __construct() {
7
+ add_action("wp_ajax_".$this->plugin."_affiliate_program", array($this, "mystickymenu_affiliate_program"));
8
+
9
+ add_action('admin_notices', array($this, 'mystickymenu_admin_notices'));
10
+ }
11
+
12
+ public function mystickymenu_affiliate_program() {
13
+ $nonce = filter_input(INPUT_POST, 'nonce', FILTER_SANITIZE_STRING);
14
+ $days = filter_input(INPUT_POST, 'days', FILTER_SANITIZE_STRING);
15
+ if(!empty($nonce) && wp_verify_nonce($nonce, $this->plugin."_affiliate_program")) {
16
+ if($days == -1) {
17
+ add_option($this->plugin."_hide_affiliate_box", "1");
18
+ } else {
19
+ $date = date("Y-m-d", strtotime("+".$days." days"));
20
+ update_option($this->plugin."_show_affiliate_box_after", $date);
21
+ }
22
+ }
23
+ die;
24
+ }
25
+
26
+ public function mystickymenu_admin_notices() {
27
+ $is_hidden = get_option($this->plugin."_hide_affiliate_box");
28
+ if($is_hidden !== false) {
29
+ return;
30
+ }
31
+
32
+ $date_to_show = get_option($this->plugin."_show_affiliate_box_after");
33
+ if($date_to_show === false || empty($date_to_show)) {
34
+ $date = date("Y-m-d", strtotime("+5 days"));
35
+ update_option($this->plugin."_show_affiliate_box_after", $date);
36
+ return;
37
+ }
38
+ $current_date = date("Y-m-d");
39
+ if( $date_to_show != '' && $current_date < $date_to_show) {
40
+ return;
41
+ }
42
+ ?>
43
+ <style>
44
+ .premio-affiliate p a {
45
+ display: inline-block;
46
+ float: right;
47
+ text-decoration: none;
48
+ color: #999999;
49
+ position: absolute;
50
+ right: 12px;
51
+ top: 12px;
52
+ }
53
+ .premio-affiliate p a:hover, .premio-affiliate p a:focus {
54
+ color: #333333;
55
+ }
56
+ .premio-affiliate .button span {
57
+ display: inline-block;
58
+ line-height: 27px;
59
+ font-size: 16px;
60
+ }
61
+ .premio-affiliate {
62
+ padding: 1px 100px 12px 12px;
63
+ margin: 15px 15px 2px;
64
+ position: relative;
65
+ }
66
+ .affiliate-popup {
67
+ position: fixed;
68
+ width: 100%;
69
+ height: 100%;
70
+ z-index: 10001;
71
+ background: rgba(0,0,0,0.65);
72
+ top: 0;
73
+ left: 0;
74
+ display: none;
75
+ }
76
+ .affiliate-popup-content {
77
+ background: #ffffff;
78
+ padding: 20px;
79
+ position: absolute;
80
+ max-width: 450px;
81
+ width: 100%;
82
+ margin: 0 auto;
83
+ top: 45%;
84
+ left: 0;
85
+ right: 0;
86
+ -webkit-border-radius: 5px;
87
+ -moz-border-radius: 5px;
88
+ border-radius: 5px;: ;
89
+ }
90
+ .affiliate-title {
91
+ padding: 0 0 10px 0;
92
+ font-weight: bold;
93
+ }
94
+ .affiliate-options a {
95
+ display: block;
96
+ margin: 5px 0 5px 0;
97
+ color: #333;
98
+ text-decoration: none;
99
+ }
100
+ .affiliate-options a.dismiss {
101
+ color: #999;
102
+ }
103
+ .affiliate-options a:hover, .affiliate-options a:focus {
104
+ color: #0073aa;
105
+ }
106
+ button.close-affiliate-popup {
107
+ position: absolute;
108
+ top: 5px;
109
+ right: 0;
110
+ border: none;
111
+ background: transparent;
112
+ cursor: pointer;
113
+ }
114
+ a.button.button-primary.affiliate-btn {
115
+ font-size: 14px;
116
+ background: #F51366;
117
+ color: #fff;
118
+ border: solid 1px #F51366;
119
+ border-radius: 3px;
120
+ line-height: 24px;
121
+ -webkit-box-shadow: 0 3px 5px -3px #333333;
122
+ -moz-box-shadow: 0 3px 5px -3px #333333;
123
+ box-shadow: 0 3px 5px -3px #333333;
124
+ text-shadow: none;
125
+ }
126
+ </style>
127
+ <div class="notice notice-info premio-affiliate <?php echo $this->plugin ?>-premio-affiliate">
128
+ <p>Hi there, you've been using My Sticky Menu for a while now. Do you know that <b>My Sticky Menu</b> has an affiliate program? Join now and get 25% lifetime commission <a href="javascript:;" class="dismiss-btn"><span class="dashicons dashicons-no-alt"></span> Dismiss</a></p>
129
+ <div class="clear clearfix"></div>
130
+ <a class="button button-primary affiliate-btn" target="_blank" href="https://premio.io/affiliates/?utm_source=inapp&domain=<?php echo $_SERVER['HTTP_HOST'] ?>">Tell me more <span class="dashicons dashicons-arrow-right-alt"></span></a>
131
+ </div>
132
+ <div class="affiliate-popup">
133
+ <div class="affiliate-popup-content">
134
+ <button class="close-affiliate-popup"><span class="dashicons dashicons-no-alt"></span></button>
135
+ <div class="affiliate-title">Would you like us to remind you about this later?</div>
136
+ <div class="affiliate-options">
137
+ <a href="javascript:;" data-days="3">Remind me in 3 days</a>
138
+ <a href="javascript:;" data-days="10">Remind me in 10 days</a>
139
+ <a href="javascript:;" data-days="-1" class="dismiss">Don't remind me about this</a>
140
+ </div>
141
+ </div>
142
+ </div>
143
+ <script>
144
+ jQuery(document).ready(function(){
145
+ jQuery(document).on("click", ".premio-affiliate p a.dismiss-btn", function(){
146
+ jQuery(".affiliate-popup").show();
147
+ });
148
+ jQuery(document).on("click", ".close-affiliate-popup", function(){
149
+ jQuery(".affiliate-popup").hide();
150
+ });
151
+ jQuery(document).on("click", ".affiliate-options a", function(){
152
+ var dataDays = jQuery(this).attr("data-days");
153
+ jQuery(".affiliate-popup").hide();
154
+ jQuery(".<?php echo $this->plugin ?>-premio-affiliate").hide();
155
+ jQuery.ajax({
156
+ url: "<?php echo admin_url("admin-ajax.php") ?>",
157
+ data: "action=<?php echo esc_attr($this->plugin) ?>_affiliate_program&days="+dataDays+"&nonce=<?php echo esc_attr(wp_create_nonce($this->plugin."_affiliate_program")) ?>",
158
+ type: "post",
159
+ success: function() {
160
+ jQuery(".affiliate-popup").remove();
161
+ jQuery(".<?php echo $this->plugin ?>-premio-affiliate").remove();
162
+ }
163
+ });
164
+ });
165
+ });
166
+ </script>
167
+ <?php
168
+ }
169
+ }
170
+ $MyStickyMenu_affiliate_program = new MyStickyMenu_affiliate_program();
mystickymenu.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: myStickymenu
4
  Plugin URI: https://premio.io/
5
  Description: Simple sticky (fixed on top) menu implementation for navigation menu and Welcome bar for announcements and promotion. After install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6
- Version: 2.2.3
7
  Author: Premio
8
  Author URI: https://premio.io/downloads/mystickymenu/
9
  Text Domain: mystickymenu
@@ -12,7 +12,7 @@ License: GPLv2 or later
12
  */
13
 
14
  defined('ABSPATH') or die("Cannot access pages directly.");
15
- define( 'MYSTICKY_VERSION', '2.2.3' );
16
  require_once("mystickymenu-fonts.php");
17
  require_once("welcome-bar.php");
18
 
@@ -117,6 +117,9 @@ class MyStickyMenuBackend
117
  foreach($post as $key=>$value) {
118
  $post[$key] = self::sanitize_options($value);
119
  }
 
 
 
120
  update_option( 'mysticky_option_name', $post);
121
  echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
122
  } else {
@@ -977,6 +980,8 @@ class MyStickyMenuFrontend
977
 
978
  if( is_admin() ) {
979
  new MyStickyMenuBackend();
 
 
980
  } else {
981
  new MyStickyMenuFrontend();
982
  }
3
  Plugin Name: myStickymenu
4
  Plugin URI: https://premio.io/
5
  Description: Simple sticky (fixed on top) menu implementation for navigation menu and Welcome bar for announcements and promotion. After install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6
+ Version: 2.2.4
7
  Author: Premio
8
  Author URI: https://premio.io/downloads/mystickymenu/
9
  Text Domain: mystickymenu
12
  */
13
 
14
  defined('ABSPATH') or die("Cannot access pages directly.");
15
+ define( 'MYSTICKY_VERSION', '2.2.4' );
16
  require_once("mystickymenu-fonts.php");
17
  require_once("welcome-bar.php");
18
 
117
  foreach($post as $key=>$value) {
118
  $post[$key] = self::sanitize_options($value);
119
  }
120
+
121
+ $post['device_desktop'] = 'on';
122
+ $post['device_mobile'] = 'on';
123
  update_option( 'mysticky_option_name', $post);
124
  echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
125
  } else {
980
 
981
  if( is_admin() ) {
982
  new MyStickyMenuBackend();
983
+ require_once 'mystickymenu-affiliate.php';
984
+
985
  } else {
986
  new MyStickyMenuFrontend();
987
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: tomeraharon, galdub, premio
3
  Tags:menu, header, sticky menu, sticky header, floating menu, floating navigation menu, navigation menu, navigation, sticky navigation menu, welcome bar, hello bar, top bar, sticky bar, floating bar, notification bar
4
  Requires at least: 3.5.1
5
  Tested up to: 5.2
6
- Stable tag: 2.2.3
7
  License: GPLv2 or later
8
 
9
  This sticky menu plugin will make your menu or header stick to the top of page, when scrolled down and up. Also create a beautiful Welcome bar with it.
@@ -257,6 +257,8 @@ After installing the plugin, you’ll have the option to turn on the welcome bar
257
 
258
 
259
  == Changelog ==
 
 
260
  = 2.2.3 =
261
  Pro version changes
262
  = 2.2.2 =
3
  Tags:menu, header, sticky menu, sticky header, floating menu, floating navigation menu, navigation menu, navigation, sticky navigation menu, welcome bar, hello bar, top bar, sticky bar, floating bar, notification bar
4
  Requires at least: 3.5.1
5
  Tested up to: 5.2
6
+ Stable tag: 2.2.4
7
  License: GPLv2 or later
8
 
9
  This sticky menu plugin will make your menu or header stick to the top of page, when scrolled down and up. Also create a beautiful Welcome bar with it.
257
 
258
 
259
  == Changelog ==
260
+ = 2.2.4 =
261
+ Smoother transition when the sticky menu disappears
262
  = 2.2.3 =
263
  Pro version changes
264
  = 2.2.2 =