myStickymenu - Version 1.8.5

Version Description

  • Improved: Improved performance and optimized scripts.
Download this release

Release Info

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

Code changes from version 1.8.4 to 1.8.5

Files changed (4) hide show
  1. js/mystickymenu.js +75 -57
  2. js/mystickymenu.min.js +1 -1
  3. mystickymenu.php +14 -7
  4. readme.txt +16 -7
js/mystickymenu.js CHANGED
@@ -1,58 +1,76 @@
1
- //disable at small screen sizes
2
- var myfixed_disable_small = parseInt(mysticky_name.mysticky_disable_at_width_string);
3
- var mybodyWidth = parseInt(document.body.clientWidth);
4
-
5
- if (mybodyWidth >= myfixed_disable_small) {
6
- // select mysticky class
7
- var mysticky_navbar = document.querySelector(mysticky_name.mysticky_string);
8
-
9
- // add mysticky_wrap div around selected mysticky class
10
- var parentmysticky = mysticky_navbar.parentNode;
11
- var wrappermysticky = document.createElement('div');
12
- var position = 0;
13
- for(var i = 0; i < parentmysticky.childNodes.length; i++) {
14
- if(parentmysticky.childNodes[i] == mysticky_navbar) {
15
- position = i;
16
- break;
17
- };
18
- };
19
- wrappermysticky.id = 'mysticky-wrap';
20
- wrappermysticky.appendChild(mysticky_navbar);
21
- parentmysticky.insertBefore(wrappermysticky, parentmysticky.childNodes[position]);
22
-
23
- // add mysticky_nav div inside selected mysticky class
24
- var parentnav = mysticky_navbar.parentNode;
25
- var wrappernav = document.createElement('div');
26
- wrappernav.id = 'mysticky-nav';
27
- parentnav.replaceChild(wrappernav, mysticky_navbar);
28
- wrappernav.appendChild(mysticky_navbar);
29
-
30
- // add myfixed and wrapfixed class to divs while scroll
31
- var mysticky_active_on_height = parseInt(mysticky_name.mysticky_active_on_height_string) ;
32
- var origOffsetY = mysticky_active_on_height ;
33
- var mydivHeight = ((mysticky_navbar.offsetHeight) + 'px');
34
-
35
- var hasScrollY = 'scrollY' in window;
36
- function onScroll(e) {
37
- var mydivWidth = ((mysticky_navbar.offsetWidth) + 'px');
38
- var mydivReset = '';
39
40
- var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
41
- y >= origOffsetY ? mysticky_navbar.classList.add('myfixed') : mysticky_navbar.classList.remove('myfixed');
42
- y >= origOffsetY ? wrappernav.classList.add('wrapfixed') : wrappernav.classList.remove('wrapfixed');
43
- y >= origOffsetY ? mysticky_navbar.style.width = mydivWidth : mysticky_navbar.style.width = mydivReset;
44
- y >= origOffsetY ? wrappermysticky.style.height = mydivHeight : wrappermysticky.style.height = mydivReset;
45
- }
46
-
47
- document.addEventListener('scroll', onScroll);
48
-
49
- function OnResizeDocument () {
50
- mysticky_navbar.style.removeProperty("width");
51
- mysticky_navbar.classList.remove('myfixed');
52
- wrappernav.classList.remove('wrapfixed');
53
- wrappermysticky.style.removeProperty("width");
54
- parentnav.style.removeProperty("height");
55
- }
56
-
57
- window.addEventListener('resize', OnResizeDocument);
58
- };
1
+ /*!
2
+ * myStickymenu by m.r.d.a
3
+ * v1.8.5
4
+ */
5
+
6
+ (function( $ ) {
7
+ 'use strict';
8
+
9
+ //jQuery(window).on("load", function($){
10
+ //jQuery(document).ready(function($){
11
+
12
+ function onScroll(e) {
13
+ var mydivWidth = ((mysticky_navbar.offsetWidth) + 'px');
14
+ var mydivReset = '';
15
16
+ var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
17
+ y >= origOffsetY ? mysticky_navbar.classList.add('myfixed') : mysticky_navbar.classList.remove('myfixed');
18
+ y >= origOffsetY ? wrappernav.classList.add('wrapfixed') : wrappernav.classList.remove('wrapfixed');
19
+ y >= origOffsetY ? mysticky_navbar.style.width = mydivWidth : mysticky_navbar.style.width = mydivReset;
20
+ y >= origOffsetY ? wrappermysticky.style.height = mydivHeight : wrappermysticky.style.height = mydivReset;
21
+ }
22
+
23
+ document.addEventListener('scroll', onScroll);
24
+
25
+ function OnResizeDocument () {
26
+ mysticky_navbar.style.removeProperty("width");
27
+ mysticky_navbar.classList.remove('myfixed');
28
+ wrappernav.classList.remove('wrapfixed');
29
+ wrappermysticky.style.removeProperty("width");
30
+ parentnav.style.removeProperty("height");
31
+ }
32
+
33
+ window.addEventListener('resize', OnResizeDocument);
34
+
35
+ //disable at small screen sizes
36
+ var myfixed_disable_small = parseInt(mysticky_name.mysticky_disable_at_width_string);
37
+ var mybodyWidth = parseInt(document.body.clientWidth);
38
+
39
+
40
+ if (mybodyWidth >= myfixed_disable_small) {
41
+ // select mysticky class
42
+ var mysticky_navbar = document.querySelector(mysticky_name.mysticky_string);
43
+
44
+ // add mysticky_wrap div around selected mysticky class
45
+ var parentmysticky = mysticky_navbar.parentNode;
46
+
47
+ var wrappermysticky = document.createElement('div');
48
+ var position = 0;
49
+ for(var i = 0; i < parentmysticky.childNodes.length; i++) {
50
+ if(parentmysticky.childNodes[i] == mysticky_navbar) {
51
+ position = i;
52
+ break;
53
+ }
54
+ }
55
+ wrappermysticky.id = 'mysticky-wrap';
56
+ wrappermysticky.appendChild(mysticky_navbar);
57
+ parentmysticky.insertBefore(wrappermysticky, parentmysticky.childNodes[position]);
58
+
59
+ // add mysticky_nav div inside selected mysticky class
60
+ var parentnav = mysticky_navbar.parentNode;
61
+ var wrappernav = document.createElement('div');
62
+ wrappernav.id = 'mysticky-nav';
63
+ parentnav.replaceChild(wrappernav, mysticky_navbar);
64
+ wrappernav.appendChild(mysticky_navbar);
65
+
66
+ // add myfixed and wrapfixed class to divs while scroll
67
+ var mysticky_active_on_height = parseInt(mysticky_name.mysticky_active_on_height_string) ;
68
+ var origOffsetY = mysticky_active_on_height ;
69
+ var mydivHeight = ((mysticky_navbar.offsetHeight) + 'px');
70
+ var hasScrollY = 'scrollY' in window;
71
+
72
+ }
73
+
74
+ //});
75
+
76
+ })(jQuery);
js/mystickymenu.min.js CHANGED
@@ -1 +1 @@
1
- function onScroll(e){var t=mysticky_navbar.offsetWidth+"px",i="",a=hasScrollY?window.scrollY:document.documentElement.scrollTop;a>=origOffsetY?mysticky_navbar.classList.add("myfixed"):mysticky_navbar.classList.remove("myfixed"),a>=origOffsetY?wrappernav.classList.add("wrapfixed"):wrappernav.classList.remove("wrapfixed"),a>=origOffsetY?mysticky_navbar.style.width=t:mysticky_navbar.style.width=i,a>=origOffsetY?wrappermysticky.style.height=mydivHeight:wrappermysticky.style.height=i}function OnResizeDocument(){mysticky_navbar.style.removeProperty("width"),mysticky_navbar.classList.remove("myfixed"),wrappernav.classList.remove("wrapfixed"),wrappermysticky.style.removeProperty("width"),parentnav.style.removeProperty("height")}var myfixed_disable_small=parseInt(mysticky_name.mysticky_disable_at_width_string),mybodyWidth=parseInt(document.body.clientWidth);if(mybodyWidth>=myfixed_disable_small){for(var mysticky_navbar=document.querySelector(mysticky_name.mysticky_string),parentmysticky=mysticky_navbar.parentNode,wrappermysticky=document.createElement("div"),position=0,i=0;i<parentmysticky.childNodes.length;i++)if(parentmysticky.childNodes[i]==mysticky_navbar){position=i;break}wrappermysticky.id="mysticky-wrap",wrappermysticky.appendChild(mysticky_navbar),parentmysticky.insertBefore(wrappermysticky,parentmysticky.childNodes[position]);var parentnav=mysticky_navbar.parentNode,wrappernav=document.createElement("div");wrappernav.id="mysticky-nav",parentnav.replaceChild(wrappernav,mysticky_navbar),wrappernav.appendChild(mysticky_navbar);var mysticky_active_on_height=parseInt(mysticky_name.mysticky_active_on_height_string),origOffsetY=mysticky_active_on_height,mydivHeight=mysticky_navbar.offsetHeight+"px",hasScrollY="scrollY"in window;document.addEventListener("scroll",onScroll),window.addEventListener("resize",OnResizeDocument)}
1
+ !function(e){"use strict";function t(e){var t=d.offsetWidth+"px",i=h?window.scrollY:document.documentElement.scrollTop;i>=m?d.classList.add("myfixed"):d.classList.remove("myfixed"),i>=m?l.classList.add("wrapfixed"):l.classList.remove("wrapfixed"),d.style.width=i>=m?t:"",n.style.height=i>=m?y:""}function i(){d.style.removeProperty("width"),d.classList.remove("myfixed"),l.classList.remove("wrapfixed"),n.style.removeProperty("width"),a.style.removeProperty("height")}document.addEventListener("scroll",t),window.addEventListener("resize",i);var s=parseInt(mysticky_name.mysticky_disable_at_width_string);if(parseInt(document.body.clientWidth)>=s){for(var d=document.querySelector(mysticky_name.mysticky_string),r=d.parentNode,n=document.createElement("div"),o=0,c=0;c<r.childNodes.length;c++)if(r.childNodes[c]==d){o=c;break}n.id="mysticky-wrap",n.appendChild(d),r.insertBefore(n,r.childNodes[o]);var a=d.parentNode,l=document.createElement("div");l.id="mysticky-nav",a.replaceChild(l,d),l.appendChild(d);var m=parseInt(mysticky_name.mysticky_active_on_height_string),y=d.offsetHeight+"px",h="scrollY"in window}}(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 default Twentythirteen navigation menu. For other themes, after install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6
- Version: 1.8.4
7
Author: m.r.d.a
8
Text Domain: mystickymenu
9
Domain Path: /languages
@@ -207,9 +207,9 @@ class MyStickyMenuPage
207
$default = array(
208
209
'mysticky_class_selector' => '.navbar',
210
- 'myfixed_zindex' => '1000000',
211
- 'myfixed_bgcolor' => '#F39A30',
212
- 'myfixed_opacity' => '95',
213
'myfixed_transition_time' => '0.3',
214
'myfixed_disable_small_screen' => '359',
215
'mysticky_active_on_height' => '320',
@@ -464,11 +464,18 @@ if ($mysticky_options ['disable_css'] == false ){
464
$mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
465
};
466
467
- if ( is_front_page() ) {
468
$mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
469
- };
470
471
- wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), false,'1.0.0', true);
472
wp_enqueue_script( 'mystickymenu' );
473
474
$mysticky_translation_array = array(
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 default Twentythirteen navigation menu. For other themes, after install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6
+ Version: 1.8.5
7
Author: m.r.d.a
8
Text Domain: mystickymenu
9
Domain Path: /languages
207
$default = array(
208
209
'mysticky_class_selector' => '.navbar',
210
+ 'myfixed_zindex' => '1000',
211
+ 'myfixed_bgcolor' => '#FAFAFA',
212
+ 'myfixed_opacity' => '90',
213
'myfixed_transition_time' => '0.3',
214
'myfixed_disable_small_screen' => '359',
215
'mysticky_active_on_height' => '320',
464
$mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
465
};
466
467
+
468
+ if ( is_front_page() && is_home() ) {
469
+
470
$mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
471
+
472
+ } elseif ( is_front_page()){
473
+
474
+ $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
475
+
476
+ }
477
478
+ wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), array('jquery'),'1.8.5', true);
479
wp_enqueue_script( 'mystickymenu' );
480
481
$mysticky_translation_array = array(
readme.txt CHANGED
@@ -4,17 +4,19 @@ Donate link: http://wordpress.transformnews.com/contact
4
Tags: sticky, menu, header, sticky menu, sticky header, floating, floating menu
5
Requires at least: 3.5.1
6
Tested up to: 4.8
7
- Stable tag: 1.8.4
8
License: GPLv2 or later
9
10
- This modern lightweight plugin will made your menu or header sticky on top of page, after desired number of pixels when scrolled.
11
12
== Description ==
13
- Plugin is designed for Twenty Thirteen template but should work on any theme. By default, it uses Twenty Thirteen navigation css class ".navbar" under "Sticky Class" setting field and that should be modified for other themes (if different) to make it work. Don’t forget this, it’s a mandatory field.
14
15
Plugin is localized (multi language support) and responsive (as far as your theme is). Also there is possibility to add custom css code which make this plugin very flexible, customizable and user friendly.
16
17
- Another advancement of this simple plugin is that increases usability and page views of your WordPress site since menu is available to the user all the time.
18
19
[Plugin Home + Demo URL][1]
20
@@ -23,8 +25,9 @@ Another advancement of this simple plugin is that increases usability and page v
23
== Installation ==
24
Install like any other plugin. After install activate.
25
Go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id…
26
- Also make sure that Disable CSS style option is not enabled, you must add myStickymenu CSS style to your style.css file first. More about disable CSS option can be found here - http://wordpress.transformnews.com/tutorials/disable-css-style-in-mystickymenu-938
27
28
29
== Frequently Asked Questions ==
30
@@ -43,8 +46,11 @@ In CSS you can style your custom class while not sticky using custom class you a
43
44
In some cases you can use the whole header div and than just style it different with .myfixed class, hide what you don’t need using CSS display:none; property, and position logo and menu as you like.
45
46
- Check Twenty Thirteen CSS example using default full header id #masthead as a sticky class - http://wordpress.transformnews.com/tutorials/mystickymenu-theme-support-682 .
47
- Also check another header example here - https://wordpress.org/support/topic/logo-in-menu-2 .
48
49
== Screenshots ==
50
@@ -54,6 +60,9 @@ Also check another header example here - https://wordpress.org/support/topic/log
54
55
== Changelog ==
56
57
= 1.8.4 =
58
* Fixed: changed is_home() to is_front_page() for menu activation height on front page.
59
4
Tags: sticky, menu, header, sticky menu, sticky header, floating, floating menu
5
Requires at least: 3.5.1
6
Tested up to: 4.8
7
+ Stable tag: 1.8.5
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.
11
12
== Description ==
13
+ By default, sticky menu is designed to use element class ".navbar" as "Sticky Class". That value should be modified in plugin settings for different themes to make it work. Sticky Class is actually nothing more than an element class (or id) of the element that should become sticky.
14
+
15
+ Advancement of this simple plugin is that increases usability and page views of your WordPress site since menu is available to the user all the time.
16
17
Plugin is localized (multi language support) and responsive (as far as your theme is). Also there is possibility to add custom css code which make this plugin very flexible, customizable and user friendly.
18
19
+ Plugin is originally designed for Twenty Thirteen template but should work on any theme.
20
21
[Plugin Home + Demo URL][1]
22
25
== Installation ==
26
Install like any other plugin. After install activate.
27
Go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id…
28
+ Also make sure that Disable CSS style option is not enabled, you must add myStickymenu CSS style to your style.css file first. [More about disable CSS option][2]
29
30
+ [2]: http://wordpress.transformnews.com/tutorials/disable-css-style-in-mystickymenu-938
31
32
== Frequently Asked Questions ==
33
46
47
In some cases you can use the whole header div and than just style it different with .myfixed class, hide what you don’t need using CSS display:none; property, and position logo and menu as you like.
48
49
+ Check [Twenty Thirteen CSS example][3] using default full header id #masthead as a sticky class.
50
+ Also here is yet [another header example][4].
51
+
52
+ [3]: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
53
+ [4]: https://wordpress.org/support/topic/logo-in-menu-2
54
55
== Screenshots ==
56
60
61
== Changelog ==
62
63
+ = 1.8.5 =
64
+ * Improved: Improved performance and optimized scripts.
65
+
66
= 1.8.4 =
67
* Fixed: changed is_home() to is_front_page() for menu activation height on front page.
68