Version Description
- Fixed: minor bug when browser resized.
Download this release
Release Info
Developer | damiroquai |
Plugin | myStickymenu |
Version | 1.8.7 |
Comparing to | |
See all releases |
Code changes from version 1.8.6 to 1.8.7
- js/mystickymenu.js +29 -28
- js/mystickymenu.min.js +1 -1
- mystickymenu.php +27 -53
- readme.txt +7 -1
js/mystickymenu.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*!
|
2 |
* myStickymenu by m.r.d.a
|
3 |
-
* v1.8.
|
4 |
*/
|
5 |
|
6 |
(function( $ ) {
|
@@ -9,35 +9,13 @@
|
|
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 |
|
@@ -66,11 +44,34 @@
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
//});
|
75 |
|
76 |
})(jQuery);
|
1 |
/*!
|
2 |
* myStickymenu by m.r.d.a
|
3 |
+
* v1.8.7
|
4 |
*/
|
5 |
|
6 |
(function( $ ) {
|
9 |
//jQuery(window).on("load", function($){
|
10 |
//jQuery(document).ready(function($){
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
//disable at small screen sizes
|
13 |
var myfixed_disable_small = parseInt(mysticky_name.mysticky_disable_at_width_string);
|
14 |
var mybodyWidth = parseInt(document.body.clientWidth);
|
15 |
|
|
|
16 |
if (mybodyWidth >= myfixed_disable_small) {
|
17 |
+
|
18 |
+
|
19 |
// select mysticky class
|
20 |
var mysticky_navbar = document.querySelector(mysticky_name.mysticky_string);
|
21 |
|
44 |
// add myfixed and wrapfixed class to divs while scroll
|
45 |
var mysticky_active_on_height = parseInt(mysticky_name.mysticky_active_on_height_string) ;
|
46 |
var origOffsetY = mysticky_active_on_height ;
|
47 |
+
|
48 |
+
var hasScrollY = 'scrollY' in window;
|
49 |
+
|
50 |
+
function onScroll(e) {
|
51 |
var mydivHeight = ((mysticky_navbar.offsetHeight) + 'px');
|
52 |
+
var mydivWidth = ((mysticky_navbar.offsetWidth) + 'px');
|
53 |
+
var mydivReset = '';
|
54 |
+
|
55 |
+
var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
|
56 |
+
y >= origOffsetY ? mysticky_navbar.classList.add('myfixed') : mysticky_navbar.classList.remove('myfixed');
|
57 |
+
y >= origOffsetY ? wrappernav.classList.add('wrapfixed') : wrappernav.classList.remove('wrapfixed');
|
58 |
+
y >= origOffsetY ? mysticky_navbar.style.width = mydivWidth : mysticky_navbar.style.width = mydivReset;
|
59 |
+
y >= origOffsetY ? wrappermysticky.style.height = mydivHeight : wrappermysticky.style.height = mydivReset;
|
60 |
+
}
|
61 |
|
62 |
+
document.addEventListener('scroll', onScroll);
|
63 |
+
|
64 |
+
function OnResizeDocument () {
|
65 |
+
mysticky_navbar.style.removeProperty("width");
|
66 |
+
mysticky_navbar.classList.remove('myfixed');
|
67 |
+
wrappernav.classList.remove('wrapfixed');
|
68 |
+
wrappermysticky.style.removeProperty("width");
|
69 |
+
parentnav.style.removeProperty("height");
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
window.addEventListener('resize', OnResizeDocument);
|
74 |
+
}
|
75 |
//});
|
76 |
|
77 |
})(jQuery);
|
js/mystickymenu.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){"use strict";function t(e){var t=d.
|
1 |
+
!function(e){"use strict";function t(e){var t=d.offsetHeight+"px",i=d.offsetWidth+"px",s=y?window.scrollY:document.documentElement.scrollTop;s>=m?d.classList.add("myfixed"):d.classList.remove("myfixed"),s>=m?l.classList.add("wrapfixed"):l.classList.remove("wrapfixed"),d.style.width=s>=m?i:"",n.style.height=s>=m?t:""}function i(){d.style.removeProperty("width"),d.classList.remove("myfixed"),l.classList.remove("wrapfixed"),n.style.removeProperty("width"),a.style.removeProperty("height")}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="scrollY"in window;document.addEventListener("scroll",t),window.addEventListener("resize",i)}}(jQuery);
|
mystickymenu.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: myStickymenu
|
4 |
Plugin URI: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
|
5 |
Description: Simple sticky (fixed on top) menu implementation for 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.
|
7 |
Author: m.r.d.a
|
8 |
Author URI: http://wordpress.transformnews.com/
|
9 |
Text Domain: mystickymenu
|
@@ -376,24 +376,9 @@ class MyStickyMenuFrontend
|
|
376 |
{
|
377 |
add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) );
|
378 |
add_action( 'wp_enqueue_scripts', array( $this, 'mystickymenu_script' ) );
|
379 |
-
|
380 |
-
}
|
381 |
-
|
382 |
-
|
383 |
-
public function mysticky_remove_more_jump_link($link)
|
384 |
-
{
|
385 |
-
$offset = strpos($link, '#more-');
|
386 |
-
if ($offset) {
|
387 |
-
$end = strpos($link, '"',$offset);
|
388 |
-
}
|
389 |
-
if ($end) {
|
390 |
-
$link = substr_replace($link, '', $offset, $end-$offset);
|
391 |
-
}
|
392 |
-
return $link;
|
393 |
}
|
394 |
-
|
395 |
-
// add_filter('the_content_more_link', 'mysticky_remove_more_jump_link');
|
396 |
-
|
397 |
public function mysticky_build_stylesheet_content()
|
398 |
{
|
399 |
|
@@ -408,57 +393,46 @@ class MyStickyMenuFrontend
|
|
408 |
|
409 |
if ($mysticky_options ['disable_css'] == false )
|
410 |
{
|
411 |
-
|
412 |
echo
|
413 |
'<style type="text/css">';
|
414 |
if ( is_user_logged_in() ) {
|
415 |
-
|
416 |
-
echo '#wpadminbar { position: absolute !important; top: 0px !important;}';
|
417 |
}
|
418 |
-
|
419 |
if ( $mysticky_options['myfixed_cssstyle'] == "" ) {
|
420 |
-
|
421 |
}
|
422 |
-
echo
|
423 |
-
|
424 |
-
echo
|
425 |
-
'
|
426 |
-
#mysticky-nav { width:100%!important; position: static;';
|
427 |
|
428 |
-
if (isset($mysticky_options['myfixed_fade']))
|
429 |
-
|
430 |
-
|
431 |
-
'top: -100px;';
|
432 |
}
|
433 |
-
echo
|
434 |
-
|
435 |
-
|
436 |
if ($mysticky_options ['myfixed_opacity'] == 100 ){
|
437 |
|
438 |
-
echo
|
439 |
-
|
440 |
-
';
|
441 |
}
|
442 |
-
|
443 |
if ($mysticky_options ['myfixed_opacity'] < 100 ){
|
444 |
-
|
445 |
-
echo
|
446 |
-
|
447 |
-
';
|
448 |
}
|
449 |
-
|
450 |
if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
';
|
455 |
}
|
456 |
-
echo
|
457 |
-
'</style>
|
458 |
-
';
|
459 |
}
|
460 |
}
|
461 |
-
|
462 |
// add_action('wp_head', 'mysticky_build_stylesheet_content');
|
463 |
|
464 |
public function mystickymenu_script() {
|
@@ -487,7 +461,7 @@ class MyStickyMenuFrontend
|
|
487 |
|
488 |
}
|
489 |
|
490 |
-
wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), array('jquery'),'1.8.
|
491 |
wp_enqueue_script( 'mystickymenu' );
|
492 |
|
493 |
$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.7
|
7 |
Author: m.r.d.a
|
8 |
Author URI: http://wordpress.transformnews.com/
|
9 |
Text Domain: mystickymenu
|
376 |
{
|
377 |
add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) );
|
378 |
add_action( 'wp_enqueue_scripts', array( $this, 'mystickymenu_script' ) );
|
379 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
}
|
381 |
+
|
|
|
|
|
382 |
public function mysticky_build_stylesheet_content()
|
383 |
{
|
384 |
|
393 |
|
394 |
if ($mysticky_options ['disable_css'] == false )
|
395 |
{
|
396 |
+
|
397 |
echo
|
398 |
'<style type="text/css">';
|
399 |
if ( is_user_logged_in() ) {
|
400 |
+
echo '#wpadminbar { position: absolute !important; top: 0px !important;}';
|
|
|
401 |
}
|
|
|
402 |
if ( $mysticky_options['myfixed_cssstyle'] == "" ) {
|
403 |
+
echo '.myfixed{margin:0 auto!important; float:none!important; border:0px!important; background:none!important; max-width:100%!important;}';
|
404 |
}
|
405 |
+
echo esc_attr ( $mysticky_options ['myfixed_cssstyle'] );
|
406 |
+
echo '#mysticky-nav { width:100%!important; position: static;';
|
|
|
|
|
|
|
407 |
|
408 |
+
if (isset($mysticky_options['myfixed_fade']))
|
409 |
+
{
|
410 |
+
echo 'top: -100px;';
|
|
|
411 |
}
|
412 |
+
echo '}';
|
413 |
+
|
414 |
+
|
415 |
if ($mysticky_options ['myfixed_opacity'] == 100 ){
|
416 |
|
417 |
+
echo '.wrapfixed { position: fixed!important; top:0px!important; left: 0px!important; margin-top:0px!important; 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; background-color: ' . $mysticky_options ['myfixed_bgcolor'] . '!important;}';
|
418 |
+
|
|
|
419 |
}
|
420 |
+
|
421 |
if ($mysticky_options ['myfixed_opacity'] < 100 ){
|
422 |
+
|
423 |
+
echo '.wrapfixed { position: fixed!important; top:0px!important; left: 0px!important; margin-top:0px!important; 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'] . '; background-color: ' . $mysticky_options ['myfixed_bgcolor'] . '!important;}';
|
424 |
+
|
|
|
425 |
}
|
426 |
+
|
427 |
if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
|
428 |
+
|
429 |
+
echo '@media (max-width: ' . $mysticky_options ['myfixed_disable_small_screen'] . 'px) {.wrapfixed {position: static!important;} }';
|
430 |
+
|
|
|
431 |
}
|
432 |
+
echo '</style>';
|
|
|
|
|
433 |
}
|
434 |
}
|
435 |
+
|
436 |
// add_action('wp_head', 'mysticky_build_stylesheet_content');
|
437 |
|
438 |
public function mystickymenu_script() {
|
461 |
|
462 |
}
|
463 |
|
464 |
+
wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), array('jquery'),'1.8.7', true);
|
465 |
wp_enqueue_script( 'mystickymenu' );
|
466 |
|
467 |
$mysticky_translation_array = array(
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wordpress.transformnews.com/contact
|
|
4 |
Tags: sticky, menu, header, sticky menu, sticky header, floating, floating menu
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 4.8
|
7 |
-
Stable tag: 1.8.
|
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.
|
@@ -56,6 +56,12 @@ In some cases you can use the whole header div and than just style it different
|
|
56 |
|
57 |
== Changelog ==
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
= 1.8.5 =
|
60 |
* Improved: Improved performance and optimized scripts.
|
61 |
|
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.7
|
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.
|
56 |
|
57 |
== Changelog ==
|
58 |
|
59 |
+
= 1.8.7 =
|
60 |
+
* Fixed: minor bug when browser resized.
|
61 |
+
|
62 |
+
= 1.8.6 =
|
63 |
+
* Fixed: minor bug.
|
64 |
+
|
65 |
= 1.8.5 =
|
66 |
* Improved: Improved performance and optimized scripts.
|
67 |
|