Version Description
iPhone and iPad notification bar and sticky menu frontend issues fixed
Download this release
Release Info
Developer | galdub |
Plugin | myStickymenu |
Version | 2.4.2 |
Comparing to | |
See all releases |
Code changes from version 2.4.1 to 2.4.2
- js/mystickymenu.js +446 -1
- js/mystickymenu.min.js +1 -1
- mystickymenu.php +4 -2
- readme.txt +3 -1
- welcome-bar.php +2 -2
js/mystickymenu.js
CHANGED
@@ -1 +1,446 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* myStickymenu by m.r.d.a
|
3 |
+
* v2.0.4
|
4 |
+
*/
|
5 |
+
(function( $ ) {
|
6 |
+
"use strict";
|
7 |
+
|
8 |
+
$(document).ready(function($){
|
9 |
+
|
10 |
+
if ( jQuery.browser.mobile && !option.device_mobile) {
|
11 |
+
return false;
|
12 |
+
} else if ( !jQuery.browser.mobile && !option.device_desktop) {
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
// get Sticky Class setting if class name existts
|
17 |
+
if ($(option.mystickyClass) [0]){
|
18 |
+
// Do nothing
|
19 |
+
} else {
|
20 |
+
// Do something if class does not exist and stop
|
21 |
+
console.log("myStickymenu: Entered Sticky Class does not exist, change it in Dashboard / Settings / myStickymenu / Sticky Class. ");
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
// Get class name
|
27 |
+
var mystickyClass = document.querySelector(option.mystickyClass);
|
28 |
+
|
29 |
+
// get disable at small screen size setting
|
30 |
+
var disableWidth = parseInt(option.disableWidth);
|
31 |
+
|
32 |
+
// get disable at large screen size setting
|
33 |
+
var disableLargeWidth = parseInt(option.disableLargeWidth);
|
34 |
+
|
35 |
+
// get transition effect (slide or fade)
|
36 |
+
var mystickyTransition = option.mystickyTransition;
|
37 |
+
|
38 |
+
// get activaton height setting
|
39 |
+
var activationHeight = parseInt(option.activationHeight);
|
40 |
+
|
41 |
+
// if is admin bar showing, needed for auto calc of activation height when admin bar is showing
|
42 |
+
var adminBar = option.adminBar;
|
43 |
+
|
44 |
+
// disable on scroll down
|
45 |
+
var mysticky_disable_down = option.mysticky_disable_down;
|
46 |
+
|
47 |
+
var viewportWidth;
|
48 |
+
|
49 |
+
function calcViewportWidth(e){
|
50 |
+
|
51 |
+
// Calculate actual viewport width
|
52 |
+
var e = window, a = 'inner';
|
53 |
+
|
54 |
+
if (!('innerWidth' in window )) {
|
55 |
+
a = 'client';
|
56 |
+
e = document.documentElement || document.body;
|
57 |
+
}
|
58 |
+
viewportWidth = e[ a+'Width' ];
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
calcViewportWidth();
|
63 |
+
|
64 |
+
var parentmysticky = mystickyClass.parentNode;
|
65 |
+
|
66 |
+
var wrappermysticky = document.createElement('div');
|
67 |
+
var position = 0;
|
68 |
+
for(var i = 0; i < parentmysticky.childNodes.length; i++) {
|
69 |
+
if(parentmysticky.childNodes[i] == mystickyClass) {
|
70 |
+
position = i;
|
71 |
+
break;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
wrappermysticky.id = 'mysticky-wrap';
|
76 |
+
wrappermysticky.appendChild(mystickyClass);
|
77 |
+
parentmysticky.insertBefore(wrappermysticky, parentmysticky.childNodes[position]);
|
78 |
+
|
79 |
+
var parentnav = mystickyClass.parentNode;
|
80 |
+
var wrappernav = document.createElement('div');
|
81 |
+
wrappernav.id = 'mysticky-nav';
|
82 |
+
parentnav.replaceChild(wrappernav, mystickyClass);
|
83 |
+
wrappernav.appendChild(mystickyClass);
|
84 |
+
|
85 |
+
// get activation height from settings
|
86 |
+
if ( activationHeight == "0" ) {
|
87 |
+
var autoActivate = true;
|
88 |
+
}
|
89 |
+
|
90 |
+
var mydivHeight;
|
91 |
+
|
92 |
+
|
93 |
+
function initialDivHeight(){
|
94 |
+
|
95 |
+
// get initial element height of selected sticky class
|
96 |
+
mydivHeight = (mystickyClass.offsetHeight);
|
97 |
+
|
98 |
+
// when initial element have margin bottom - awaken example using #masthead class
|
99 |
+
if (parseInt($(mystickyClass).css("marginBottom")) > 0) {
|
100 |
+
|
101 |
+
// element have margin bottom, apply it to initial wrap
|
102 |
+
//$(mystickyClass).css("marginBottom").replace('px', '')
|
103 |
+
wrappermysticky.style.marginBottom = ($(mystickyClass).css("marginBottom"));
|
104 |
+
}
|
105 |
+
|
106 |
+
if (mydivHeight == "0") {
|
107 |
+
// 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
|
108 |
+
|
109 |
+
$(mystickyClass).children().filter(':visible').each(function(){
|
110 |
+
mydivHeight = $(this).outerHeight(true);
|
111 |
+
|
112 |
+
});
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
if (viewportWidth >= disableWidth) {
|
117 |
+
//wrappermysticky.style.height = mydivHeight + 'px';
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
initialDivHeight();
|
122 |
+
|
123 |
+
var myfixedHeight;
|
124 |
+
|
125 |
+
function fixedDivHeight(){
|
126 |
+
//if ( autoActivate == true ) {
|
127 |
+
|
128 |
+
// calculate element height while fixed
|
129 |
+
mystickyClass.classList.add('myfixed')
|
130 |
+
|
131 |
+
myfixedHeight = $(".myfixed").outerHeight();
|
132 |
+
|
133 |
+
if (myfixedHeight == "0") {
|
134 |
+
// something is wrong, wrapper cant be zero, try to calculate again with div children.
|
135 |
+
$(".myfixed").children().filter(':visible').each(function(){
|
136 |
+
myfixedHeight = $(this).outerHeight(true);
|
137 |
+
});
|
138 |
+
}
|
139 |
+
|
140 |
+
mystickyClass.classList.remove('myfixed');
|
141 |
+
|
142 |
+
//}
|
143 |
+
|
144 |
+
}
|
145 |
+
|
146 |
+
fixedDivHeight();
|
147 |
+
|
148 |
+
var adminBarHeight = 0;
|
149 |
+
|
150 |
+
function calcAdminBarHeight(){
|
151 |
+
|
152 |
+
if ((adminBar == "true" ) && (viewportWidth > 600)) {
|
153 |
+
|
154 |
+
if ($("#wpadminbar")[0]){
|
155 |
+
adminBarHeight = $('#wpadminbar').height();
|
156 |
+
} else {
|
157 |
+
adminBarHeight = 0;
|
158 |
+
}
|
159 |
+
} else {
|
160 |
+
adminBarHeight = 0;
|
161 |
+
}
|
162 |
+
|
163 |
+
|
164 |
+
//wrappernav.style.top = adminBarHeight + "px";
|
165 |
+
if (mystickyTransition == "slide") {
|
166 |
+
wrappernav.style.top = "-" + myfixedHeight + "px";
|
167 |
+
//wrappernav.style.top = "-" + myfixedHeight + "px";
|
168 |
+
} else {
|
169 |
+
wrappernav.style.top = adminBarHeight + "px";
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
calcAdminBarHeight();
|
175 |
+
|
176 |
+
|
177 |
+
var mydivWidth;
|
178 |
+
|
179 |
+
function initialDivWidth(){
|
180 |
+
|
181 |
+
var rect = $(mystickyClass)[0].getBoundingClientRect();
|
182 |
+
mydivWidth = rect.width;
|
183 |
+
|
184 |
+
//var mydivWidth = ((mystickyClass.offsetWidth) + 'px');
|
185 |
+
//mystickyClass.style.width = mydivWidth + "px";
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
initialDivWidth();
|
190 |
+
|
191 |
+
|
192 |
+
|
193 |
+
|
194 |
+
var deactivationHeight = activationHeight;
|
195 |
+
|
196 |
+
function calcActivationHeight() {
|
197 |
+
|
198 |
+
// If activate height (Make visible on Scroll) is set to 0, automatic calculation will be used.
|
199 |
+
if ( autoActivate == true ) {
|
200 |
+
|
201 |
+
// Automatic calculation of activation and deactivation height (Make visible on Scroll is set to 0).
|
202 |
+
if (mystickyTransition == "slide") {
|
203 |
+
// Slide effect is selected
|
204 |
+
//activationHeight = $(mystickyClass).offset().top + mystickyClass.offsetHeight - adminBarHeight;
|
205 |
+
activationHeight = $(mystickyClass).offset().top + mydivHeight - adminBarHeight;
|
206 |
+
deactivationHeight = $(mystickyClass).offset().top + mydivHeight - adminBarHeight;
|
207 |
+
//deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
|
208 |
+
|
209 |
+
if (mysticky_disable_down == "on") {
|
210 |
+
deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
if (mystickyTransition == "fade") {
|
217 |
+
|
218 |
+
if (mysticky_disable_down == "false") {
|
219 |
+
// Fade effect is selected
|
220 |
+
activationHeight = $(mystickyClass).offset().top - adminBarHeight;
|
221 |
+
|
222 |
+
deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
if (mysticky_disable_down == "on") {
|
227 |
+
|
228 |
+
// Fade effect is selected
|
229 |
+
activationHeight = $(mystickyClass).offset().top - adminBarHeight + mydivHeight;
|
230 |
+
deactivationHeight = $(mystickyClass).offset().top - adminBarHeight;
|
231 |
+
|
232 |
+
}
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
}
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
calcActivationHeight();
|
241 |
+
|
242 |
+
function headerDeactivateOnHeight() {
|
243 |
+
|
244 |
+
|
245 |
+
if ( autoActivate == true ) {
|
246 |
+
|
247 |
+
if ( mydivHeight > myfixedHeight ){
|
248 |
+
// Auto activate is true, Make visible on Scroll is set to 0, menu is probably header
|
249 |
+
|
250 |
+
if (mystickyTransition == "slide") {
|
251 |
+
// slide effect is selected
|
252 |
+
deactivationHeight = activationHeight;
|
253 |
+
|
254 |
+
if (mysticky_disable_down == "on") {
|
255 |
+
deactivationHeight = activationHeight - myfixedHeight;
|
256 |
+
}
|
257 |
+
|
258 |
+
} else {
|
259 |
+
activationHeight = mydivHeight;
|
260 |
+
deactivationHeight = mydivHeight;
|
261 |
+
|
262 |
+
}
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
headerDeactivateOnHeight();
|
268 |
+
|
269 |
+
|
270 |
+
|
271 |
+
var hasScrollY = 'scrollY' in window;
|
272 |
+
var lastScrollTop = 0;
|
273 |
+
|
274 |
+
|
275 |
+
function onScroll(e) {
|
276 |
+
var mystickymenu_top_pos = $( '.mysticky-welcomebar-fixed' ).css( 'top' );
|
277 |
+
var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position');
|
278 |
+
var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight();
|
279 |
+
var mystickymenu_show = $( '.mysticky-welcomebar-fixed' ).length;
|
280 |
+
var welcomebar_appear = $( 'body' ).hasClass( 'mysticky-welcomebar-apper' );
|
281 |
+
if( mystickymenu_show && parseInt(mystickymenu_top_pos) >= 0 && welcombar_position == 'top' && welcomebar_appear ) {
|
282 |
+
var mystickymenu_pos = welcombar_height;
|
283 |
+
adminBarHeight = 0;
|
284 |
+
} else {
|
285 |
+
var mystickymenu_pos = '';
|
286 |
+
}
|
287 |
+
//initialDivHeight();
|
288 |
+
|
289 |
+
// if body width is larger than disable at small screen size setting
|
290 |
+
|
291 |
+
if (viewportWidth >= disableWidth) {
|
292 |
+
|
293 |
+
if ( disableLargeWidth == 0 || viewportWidth <= disableLargeWidth ) {
|
294 |
+
|
295 |
+
//if (mysticky_disable_down == "on") {
|
296 |
+
|
297 |
+
var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
|
298 |
+
//var yScrollPosition = $(this).scrollTop();
|
299 |
+
/*30-04-2020 st*/
|
300 |
+
if( document.documentElement.scrollTop == 0 ) {
|
301 |
+
wrappernav.classList.remove('wrapfixed');
|
302 |
+
}
|
303 |
+
/*30-04-2020 end*/
|
304 |
+
|
305 |
+
// add up or down class to the element depending on scroll direction
|
306 |
+
if (0 <= y ) {
|
307 |
+
|
308 |
+
//var st = $(this).scrollTop();
|
309 |
+
|
310 |
+
|
311 |
+
if (y >= lastScrollTop){
|
312 |
+
|
313 |
+
// downscroll code
|
314 |
+
// add myfixed and wrapfixed class to selected fixed element while scroll down
|
315 |
+
y >= activationHeight ? mystickyClass.classList.add('myfixed') : "";
|
316 |
+
y >= activationHeight ? wrappernav.classList.add('wrapfixed') : "";
|
317 |
+
|
318 |
+
y >= activationHeight ? wrappermysticky.style.height = mydivHeight + 'px' : "";
|
319 |
+
y >= activationHeight ? mystickyClass.style.width = mydivWidth + "px" : "";
|
320 |
+
|
321 |
+
|
322 |
+
if (mystickyTransition == "slide") {
|
323 |
+
|
324 |
+
if (mysticky_disable_down == "false") {
|
325 |
+
//y < activationHeight + (myfixedHeight + 250) - adminBarHeight ? wrappernav.style.top = "-" + myfixedHeight + "px" : '';
|
326 |
+
//wrappernav.style.top = "-" + myfixedHeight + "px"
|
327 |
+
y >= activationHeight + myfixedHeight - adminBarHeight ? wrappernav.style.top = (adminBarHeight + mystickymenu_pos) + "px" : wrappernav.style.top = "-" + myfixedHeight + "px";
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
+
if ( mydivHeight > myfixedHeight ){
|
332 |
+
// if it's header (guess)
|
333 |
+
|
334 |
+
if (mysticky_disable_down == "false") {
|
335 |
+
|
336 |
+
y < activationHeight + myfixedHeight ? wrappernav.style.top = "-" + mydivHeight + "px" : '';
|
337 |
+
y >= activationHeight + myfixedHeight ? wrappernav.style.top = (adminBarHeight + mystickymenu_pos) + "px" : '';
|
338 |
+
|
339 |
+
}
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
+
}
|
344 |
+
|
345 |
+
wrappernav.classList.add('down');
|
346 |
+
wrappernav.classList.remove('up');
|
347 |
+
|
348 |
+
|
349 |
+
if (mysticky_disable_down == "on") {
|
350 |
+
wrappernav.style.top = "-" + (mydivHeight + adminBarHeight ) + "px";
|
351 |
+
jQuery('#mysticky-nav ' + option.mystickyClass+'.elementor-sticky').hide();
|
352 |
+
//jQuery('#mysticky-nav ' + option.mystickyClass).css( 'top' , "-" + (mydivHeight + adminBarHeight ) + "px");
|
353 |
+
}
|
354 |
+
|
355 |
+
} else {
|
356 |
+
// upscroll code
|
357 |
+
var x = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
|
358 |
+
//x > deactivationHeight ? '' : mystickyClass.classList.remove('myfixed') ;
|
359 |
+
//x > deactivationHeight ? '' : wrappernav.classList.remove('wrapfixed');
|
360 |
+
|
361 |
+
x > deactivationHeight ? "" : wrappermysticky.style.height = "";
|
362 |
+
x > deactivationHeight ? "" : mystickyClass.style.width = "";
|
363 |
+
|
364 |
+
if (mystickyTransition == "slide") {
|
365 |
+
|
366 |
+
x > deactivationHeight ? '' : mystickyClass.classList.remove('myfixed') ;
|
367 |
+
x > deactivationHeight ? '' : wrappernav.classList.remove('wrapfixed');
|
368 |
+
|
369 |
+
if (mysticky_disable_down == "false") {
|
370 |
+
|
371 |
+
x < deactivationHeight + myfixedHeight + 200 - adminBarHeight ? wrappernav.style.top = "-" + myfixedHeight + "px" : '';
|
372 |
+
}
|
373 |
+
|
374 |
+
} else {
|
375 |
+
x > deactivationHeight ? "" : mystickyClass.classList.remove('myfixed') ;
|
376 |
+
x > deactivationHeight ? "" : wrappernav.classList.remove('wrapfixed');
|
377 |
+
}
|
378 |
+
wrappernav.classList.remove('down');
|
379 |
+
wrappernav.classList.add('up');
|
380 |
+
|
381 |
+
if (mysticky_disable_down == "on") {
|
382 |
+
wrappernav.style.top = (adminBarHeight + mystickymenu_pos) + "px";
|
383 |
+
jQuery('#mysticky-nav '+ option.mystickyClass).css( 'width' , mydivWidth + "px");
|
384 |
+
jQuery('#mysticky-nav ' + option.mystickyClass+'.elementor-sticky').show();
|
385 |
+
|
386 |
+
}
|
387 |
+
|
388 |
+
}
|
389 |
+
|
390 |
+
lastScrollTop = y;
|
391 |
+
|
392 |
+
} else {
|
393 |
+
//if (mysticky_disable_down == "on") {
|
394 |
+
wrappernav.classList.remove('up');
|
395 |
+
//}
|
396 |
+
}
|
397 |
+
|
398 |
+
} // if disableWidth is greater than zero
|
399 |
+
|
400 |
+
|
401 |
+
} // if disableLargeWidth is 0 or greater than zero
|
402 |
+
|
403 |
+
}
|
404 |
+
|
405 |
+
document.addEventListener('scroll', onScroll);
|
406 |
+
|
407 |
+
|
408 |
+
var width = $(window).width()
|
409 |
+
|
410 |
+
function OnResizeDocument () {
|
411 |
+
// don't recalculate on height change, only width
|
412 |
+
if($(window).width() != width ){
|
413 |
+
|
414 |
+
wrappernav.classList.remove('up');
|
415 |
+
wrappernav.classList.remove('down');
|
416 |
+
|
417 |
+
if ($(".wrapfixed")[0]){
|
418 |
+
// If class wrapfixed exists
|
419 |
+
// Remove myfixed and wrapfixed clases so we can calculate
|
420 |
+
//mystickyClass.classList.remove('myfixed');
|
421 |
+
//wrappernav.classList.remove('wrapfixed');
|
422 |
+
|
423 |
+
} else {
|
424 |
+
// Else class wrapfixed does not exists
|
425 |
+
initialDivHeight();
|
426 |
+
|
427 |
+
// Remove width
|
428 |
+
mystickyClass.style.removeProperty("width");
|
429 |
+
initialDivWidth();
|
430 |
+
|
431 |
+
}
|
432 |
+
calcViewportWidth();
|
433 |
+
calcAdminBarHeight();
|
434 |
+
fixedDivHeight();
|
435 |
+
calcActivationHeight();
|
436 |
+
headerDeactivateOnHeight();
|
437 |
+
}
|
438 |
+
}
|
439 |
+
|
440 |
+
window.addEventListener('resize', OnResizeDocument);
|
441 |
+
|
442 |
+
// need to test this, it should fire script on mobile orientation change, since onresize is somehow faulty in this case
|
443 |
+
window.addEventListener('orientationchange', OnResizeDocument);
|
444 |
+
});
|
445 |
+
|
446 |
+
})(jQuery);
|
js/mystickymenu.min.js
CHANGED
@@ -1 +1 @@
|
|
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),
|
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),s=parseInt(option.disableWidth),o=parseInt(option.disableLargeWidth),n=option.mystickyTransition,d=parseInt(option.activationHeight),a=option.adminBar,r=option.mysticky_disable_down;C();for(var l=i.parentNode,c=document.createElement("div"),m=0,p=0;p<l.childNodes.length;p++)if(l.childNodes[p]==i){m=p;break}c.id="mysticky-wrap",c.appendChild(i),l.insertBefore(c,l.childNodes[m]);var y,f,u=i.parentNode,w=document.createElement("div");if(w.id="mysticky-nav",u.replaceChild(w,i),w.appendChild(i),"0"==d)var h=!0;E(),j();var v,x=0;B(),H();var k=d;Q(),S();var b="scrollY"in window,g=0;document.addEventListener("scroll",function(a){var l=e(".mysticky-welcomebar-fixed").css("top"),m=e(".mysticky-welcomebar-fixed").data("position"),p=e(".mysticky-welcomebar-fixed").outerHeight(),u=e(".mysticky-welcomebar-fixed").length,h=e("body").hasClass("mysticky-welcomebar-apper");if(u&&parseInt(l)>=0&&"top"==m&&h){var L=p;x=0}else L="";if(t>=s&&(0==o||t<=o)){var C=b?window.scrollY:document.documentElement.scrollTop;if(0==document.documentElement.scrollTop&&w.classList.remove("wrapfixed"),0<=C){if(C>=g)C>=d&&i.classList.add("myfixed"),C>=d&&w.classList.add("wrapfixed"),C>=d&&(c.style.height=y+"px"),C>=d&&(i.style.width=v+"px"),"slide"==n&&("false"==r&&(w.style.top=C>=d+f-x?x+L+"px":"-"+f+"px"),y>f&&"false"==r&&(C<d+f&&(w.style.top="-"+y+"px"),C>=d+f&&(w.style.top=x+L+"px"))),w.classList.add("down"),w.classList.remove("up"),"on"==r&&(w.style.top="-"+(y+x)+"px",jQuery("#mysticky-nav "+option.mystickyClass+".elementor-sticky").hide());else{var E=b?window.scrollY:document.documentElement.scrollTop;!(E>k)&&(c.style.height=""),!(E>k)&&(i.style.width=""),"slide"==n?(!(E>k)&&i.classList.remove("myfixed"),!(E>k)&&w.classList.remove("wrapfixed"),"false"==r&&E<k+f+200-x&&(w.style.top="-"+f+"px")):(!(E>k)&&i.classList.remove("myfixed"),!(E>k)&&w.classList.remove("wrapfixed")),w.classList.remove("down"),w.classList.add("up"),"on"==r&&(w.style.top=x+L+"px",jQuery("#mysticky-nav "+option.mystickyClass).css("width",v+"px"),jQuery("#mysticky-nav "+option.mystickyClass+".elementor-sticky").show())}g=C}else w.classList.remove("up")}});var L=e(window).width();window.addEventListener("resize",I),window.addEventListener("orientationchange",I)}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&&(c.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"==a&&t>600&&e("#wpadminbar")[0]?e("#wpadminbar").height():0,w.style.top="slide"==n?"-"+f+"px":x+"px"}function H(){var t=e(i)[0].getBoundingClientRect();v=t.width}function Q(){1==h&&("slide"==n&&(d=e(i).offset().top+y-x,k=e(i).offset().top+y-x,"on"==r&&(k=e(i).offset().top-x)),"fade"==n&&("false"==r&&(d=e(i).offset().top-x,k=e(i).offset().top-x),"on"==r&&(d=e(i).offset().top-x+y,k=e(i).offset().top-x)))}function S(){1==h&&y>f&&("slide"==n?(k=d,"on"==r&&(k=d-f)):(d=y,k=y))}function I(){e(window).width()!=L&&(w.classList.remove("up"),w.classList.remove("down"),e(".wrapfixed")[0]||(E(),i.style.removeProperty("width"),H()),C(),B(),j(),Q(),S())}})}();
|
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.4.
|
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.4.
|
16 |
require_once("mystickymenu-fonts.php");
|
17 |
require_once("welcome-bar.php");
|
18 |
|
@@ -1029,7 +1029,9 @@ class MyStickyMenuFrontend
|
|
1029 |
echo '<style id="mystickymenu" type="text/css">';
|
1030 |
echo '#mysticky-nav { width:100%; position: static; }';
|
1031 |
echo '#mysticky-nav.wrapfixed { position:fixed; left: 0px; margin-top:0px; z-index: '. $mysticky_options ['myfixed_zindex'] .'; -webkit-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -moz-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -o-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . $mysticky_options ['myfixed_opacity'] . ')"; filter: alpha(opacity=' . $mysticky_options ['myfixed_opacity'] . '); opacity:' . $mysticky_options ['myfixed_opacity'] / 100 . '; background-color: ' . $mysticky_options ['myfixed_bgcolor'] . ';}';
|
|
|
1032 |
echo '#mysticky-nav.wrapfixed ul li.menu-item a { color: ' . $mysticky_options ['myfixed_textcolor'] . ';}';
|
|
|
1033 |
|
1034 |
|
1035 |
if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
|
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.4.2
|
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.4.2' );
|
16 |
require_once("mystickymenu-fonts.php");
|
17 |
require_once("welcome-bar.php");
|
18 |
|
1029 |
echo '<style id="mystickymenu" type="text/css">';
|
1030 |
echo '#mysticky-nav { width:100%; position: static; }';
|
1031 |
echo '#mysticky-nav.wrapfixed { position:fixed; left: 0px; margin-top:0px; z-index: '. $mysticky_options ['myfixed_zindex'] .'; -webkit-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -moz-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -o-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . $mysticky_options ['myfixed_opacity'] . ')"; filter: alpha(opacity=' . $mysticky_options ['myfixed_opacity'] . '); opacity:' . $mysticky_options ['myfixed_opacity'] / 100 . '; background-color: ' . $mysticky_options ['myfixed_bgcolor'] . ';}';
|
1032 |
+
if ( isset($mysticky_options ['myfixed_textcolor']) && $mysticky_options ['myfixed_textcolor'] != '' ) {
|
1033 |
echo '#mysticky-nav.wrapfixed ul li.menu-item a { color: ' . $mysticky_options ['myfixed_textcolor'] . ';}';
|
1034 |
+
}
|
1035 |
|
1036 |
|
1037 |
if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
|
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.4
|
6 |
-
Stable tag: 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 notification bar with it.
|
@@ -265,6 +265,8 @@ After installing the plugin, you’ll have the option to turn on the welcome bar
|
|
265 |
|
266 |
|
267 |
== Changelog ==
|
|
|
|
|
268 |
= 2.4.1 =
|
269 |
Credit removal
|
270 |
= 2.4 =
|
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.4
|
6 |
+
Stable tag: 2.4.2
|
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 notification bar with it.
|
265 |
|
266 |
|
267 |
== Changelog ==
|
268 |
+
= 2.4.2 =
|
269 |
+
iPhone and iPad notification bar and sticky menu frontend issues fixed
|
270 |
= 2.4.1 =
|
271 |
Credit removal
|
272 |
= 2.4 =
|
welcome-bar.php
CHANGED
@@ -1016,7 +1016,7 @@ function mysticky_welcome_bar_frontend(){
|
|
1016 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' );
|
1017 |
$( 'html' ).css( 'margin-bottom', '' );
|
1018 |
$( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' );
|
1019 |
-
$( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' );
|
1020 |
} else {
|
1021 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' );
|
1022 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' );
|
@@ -1037,7 +1037,7 @@ function mysticky_welcome_bar_frontend(){
|
|
1037 |
jQuery( '.mysticky-welcomebar-apper.et_fixed_nav #top-header' ).css( 'top', welcombar_height + 'px' );
|
1038 |
jQuery( 'head' ).append( '<style id="mysticky_divi_style" type="text/css">.mysticky-welcomebar-apper.et_fixed_nav #main-header {top: ' + welcombar_height + 'px !important}.mysticky-welcomebar-apper.et_fixed_nav #top-header + #main-header{top: ' + divi_total_height + 'px !important}</style>' );
|
1039 |
$( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' );
|
1040 |
-
$( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' );
|
1041 |
} else {
|
1042 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' );
|
1043 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' );
|
1016 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' );
|
1017 |
$( 'html' ).css( 'margin-bottom', '' );
|
1018 |
$( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' );
|
1019 |
+
$( '.mysticky-welcomebar-apper #mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' );
|
1020 |
} else {
|
1021 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' );
|
1022 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' );
|
1037 |
jQuery( '.mysticky-welcomebar-apper.et_fixed_nav #top-header' ).css( 'top', welcombar_height + 'px' );
|
1038 |
jQuery( 'head' ).append( '<style id="mysticky_divi_style" type="text/css">.mysticky-welcomebar-apper.et_fixed_nav #main-header {top: ' + welcombar_height + 'px !important}.mysticky-welcomebar-apper.et_fixed_nav #top-header + #main-header{top: ' + divi_total_height + 'px !important}</style>' );
|
1039 |
$( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' );
|
1040 |
+
$( '.mysticky-welcomebar-apper #mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' );
|
1041 |
} else {
|
1042 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' );
|
1043 |
jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' );
|