Version Description
- Ready for WordPress 4.1 (and TwentyFifteen).
- Fixes issue when element has padding in percentages.
Download this release
Release Info
Developer | senff |
Plugin | Sticky Menu (or Anything!) on Scroll |
Version | 1.1.4 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.1.4
- README.md +20 -8
- assets/js/jq-sticky-anything.js +4 -1
- assets/js/jq-sticky-anything.min.js +1 -4
- readme.txt +19 -7
- sticky-menu-or-anything.php +5 -5
README.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
* Tags: plugin, sticky, menu, scroll, element
|
4 |
* Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
5 |
* Requires at least: 3.6
|
6 |
-
* Tested up to: 4.
|
7 |
-
* Stable tag: 1.1.
|
8 |
* License: GPLv2 or later
|
9 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,6 +40,10 @@ A little bit of basic HTML/CSS knowledge is required. You just need to know how
|
|
40 |
### I selected a class/ID in the settings screen, but the element doesn't stick when I scroll downs. Why not?
|
41 |
Make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
|
42 |
|
|
|
|
|
|
|
|
|
43 |
### Still doesn't work. What could be wrong?
|
44 |
Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that returns zero elements on the page, OR more than one, it will be shown.
|
45 |
|
@@ -49,7 +53,7 @@ The current version only allows one sticky element. Having more than one may clu
|
|
49 |
### I'll need more help please!
|
50 |
The plugin's own page can be found [here](http://www.senff.com/plugins/sticky-anything-wp).
|
51 |
|
52 |
-
For any other issues, please use the [WordPress.org forum](https://wordpress.org/support/).
|
53 |
|
54 |
|
55 |
## Screenshots
|
@@ -59,6 +63,10 @@ For any other issues, please use the [WordPress.org forum](https://wordpress.org
|
|
59 |
|
60 |
## Changelog
|
61 |
|
|
|
|
|
|
|
|
|
62 |
### 1.1.3
|
63 |
* Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported.
|
64 |
|
@@ -77,17 +85,21 @@ For any other issues, please use the [WordPress.org forum](https://wordpress.org
|
|
77 |
|
78 |
## Upgrade Notice
|
79 |
|
|
|
|
|
|
|
|
|
80 |
### 1.1.3
|
81 |
-
Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported.
|
82 |
|
83 |
### 1.1.2
|
84 |
-
Fixes element width calculation bug.
|
85 |
|
86 |
### 1.1.1
|
87 |
-
Fixes viewport calculation bug.
|
88 |
|
89 |
### 1.1
|
90 |
-
Added functionality: you can now set a minimum and/or maximum screen size where the element should be sticky (handy for responsive designs, should you not want your element to be sticky below or above certain screen sizes).
|
91 |
|
92 |
### 1.0
|
93 |
-
Initial release of the plugin.
|
3 |
* Tags: plugin, sticky, menu, scroll, element
|
4 |
* Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
5 |
* Requires at least: 3.6
|
6 |
+
* Tested up to: 4.1
|
7 |
+
* Stable tag: 1.1.4
|
8 |
* License: GPLv2 or later
|
9 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
40 |
### I selected a class/ID in the settings screen, but the element doesn't stick when I scroll downs. Why not?
|
41 |
Make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
|
42 |
|
43 |
+
### I'm having some issues on mobile (or other responsive themes).
|
44 |
+
Some themes use some JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn't exist in the HTML source code upon page load, but is created on the fly some time after the page is fully loaded. Since the Sticky Anything plugin only works with elements that are present in the HTML source code, this can cause issues.
|
45 |
+
There is an experimental version of the plugin that addresses this issue, but it is not public since most themes do not use this method (and other plugins may rely on having the sticky menu present before they load). If you are interested in trying this version, please get in touch with me through http://www.senff.com/ and I will be happy to provide you this version, along with some help.
|
46 |
+
|
47 |
### Still doesn't work. What could be wrong?
|
48 |
Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that returns zero elements on the page, OR more than one, it will be shown.
|
49 |
|
53 |
### I'll need more help please!
|
54 |
The plugin's own page can be found [here](http://www.senff.com/plugins/sticky-anything-wp).
|
55 |
|
56 |
+
For any other issues, please use the [WordPress.org forum](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll).
|
57 |
|
58 |
|
59 |
## Screenshots
|
63 |
|
64 |
## Changelog
|
65 |
|
66 |
+
### 1.1.4
|
67 |
+
* Ready for WordPress 4.1 (and TwentyFifteen).
|
68 |
+
* Fixes issue when element has padding in percentages.
|
69 |
+
|
70 |
### 1.1.3
|
71 |
* Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported.
|
72 |
|
85 |
|
86 |
## Upgrade Notice
|
87 |
|
88 |
+
### 1.1.4
|
89 |
+
* Ready for WordPress 4.1 (and TwentyFifteen).
|
90 |
+
* Fixes issue when element has padding in percentages.
|
91 |
+
|
92 |
### 1.1.3
|
93 |
+
* Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported.
|
94 |
|
95 |
### 1.1.2
|
96 |
+
* Fixes element width calculation bug.
|
97 |
|
98 |
### 1.1.1
|
99 |
+
* Fixes viewport calculation bug.
|
100 |
|
101 |
### 1.1
|
102 |
+
* Added functionality: you can now set a minimum and/or maximum screen size where the element should be sticky (handy for responsive designs, should you not want your element to be sticky below or above certain screen sizes).
|
103 |
|
104 |
### 1.0
|
105 |
+
* Initial release of the plugin.
|
assets/js/jq-sticky-anything.js
CHANGED
@@ -62,8 +62,11 @@ function stickIt(stickyTop,minwidth,maxwidth) {
|
|
62 |
coordsOrgElement = orgElement.offset();
|
63 |
leftOrgElement = coordsOrgElement.left;
|
64 |
widthOrgElement = orgElement.css('width');
|
|
|
|
|
|
|
65 |
|
66 |
-
$('.cloned').css('left',leftOrgElement+'px').css('top',stickyTop+'px').css('width',widthOrgElement).show();
|
67 |
$('.original').css('visibility','hidden');
|
68 |
} else {
|
69 |
// not scrolled past the menu; only show the original menu.
|
62 |
coordsOrgElement = orgElement.offset();
|
63 |
leftOrgElement = coordsOrgElement.left;
|
64 |
widthOrgElement = orgElement.css('width');
|
65 |
+
// If padding is percentages, convert to pixels
|
66 |
+
paddingOrgElement = [orgElement.css('padding-top'), orgElement.css('padding-right'), orgElement.css('padding-bottom'), orgElement.css('padding-left')];
|
67 |
+
paddingCloned = paddingOrgElement[0] + ' ' + paddingOrgElement[1] + ' ' + paddingOrgElement[2] + ' ' + paddingOrgElement[3];
|
68 |
|
69 |
+
$('.cloned').css('left',leftOrgElement+'px').css('top',stickyTop+'px').css('width',widthOrgElement).css('padding',paddingCloned).show();
|
70 |
$('.original').css('visibility','hidden');
|
71 |
} else {
|
72 |
// not scrolled past the menu; only show the original menu.
|
assets/js/jq-sticky-anything.min.js
CHANGED
@@ -1,4 +1 @@
|
|
1 |
-
|
2 |
-
* @preserve Sticky Anything 1.1.3 | @senff | GPL2 Licensed
|
3 |
-
*/
|
4 |
-
(function(e){function t(t,n,r){var i=e(".original").offset();orgElementTop=i.top;var s=window,o="inner";if(!("innerWidth"in window)){o="client";s=document.documentElement||document.body}viewport=s[o+"Width"];if(e(window).scrollTop()>=orgElementTop-t&&viewport>=n&&viewport<=r){orgElement=e(".original");coordsOrgElement=orgElement.offset();leftOrgElement=coordsOrgElement.left;widthOrgElement=orgElement.css("width");e(".cloned").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthOrgElement).show();e(".original").css("visibility","hidden")}else{e(".cloned").hide();e(".original").css("visibility","visible")}}e.fn.stickThis=function(n){var r=e.extend({top:0,minscreenwidth:0,maxscreenwidth:99999,zindex:1,debugmode:false},n);var i=e(this).length;if(i<1){if(r.debugmode==true){console.error("STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected.")}}else if(i>1){if(r.debugmode==true){console.error("STICKY ANYTHING DEBUG: There is more than one element with the selector/class/ID you selected. You can only make ONE element sticky.")}}else{e(this).addClass("original").clone().insertAfter(this).addClass("cloned").css("position","fixed").css("top",r.top+"px").css("margin-top","0").css("margin-left","0").css("z-index",r.zindex).removeClass("original").hide();checkElement=setInterval(function(){t(r.top,r.minscreenwidth,r.maxscreenwidth)},10)}return this}})(jQuery)
|
1 |
+
(function(e){function t(t,n,r){var i=e(".original").offset();orgElementTop=i.top;var s=window,o="inner";if(!("innerWidth"in window)){o="client";s=document.documentElement||document.body}viewport=s[o+"Width"];if(e(window).scrollTop()>=orgElementTop-t&&viewport>=n&&viewport<=r){orgElement=e(".original");coordsOrgElement=orgElement.offset();leftOrgElement=coordsOrgElement.left;widthOrgElement=orgElement.css("width");paddingOrgElement=[orgElement.css("padding-top"),orgElement.css("padding-right"),orgElement.css("padding-bottom"),orgElement.css("padding-left")];paddingCloned=paddingOrgElement[0]+" "+paddingOrgElement[1]+" "+paddingOrgElement[2]+" "+paddingOrgElement[3];e(".cloned").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthOrgElement).css("padding",paddingCloned).show();e(".original").css("visibility","hidden")}else{e(".cloned").hide();e(".original").css("visibility","visible")}}e.fn.stickThis=function(n){var r=e.extend({top:0,minscreenwidth:0,maxscreenwidth:99999,zindex:1,debugmode:false},n);var i=e(this).length;if(i<1){if(r.debugmode==true){console.error("STICKY ANYTHING DEBUG: There are no elements with the selector/class/ID you selected.")}}else if(i>1){if(r.debugmode==true){console.error("STICKY ANYTHING DEBUG: There is more than one element with the selector/class/ID you selected. You can only make ONE element sticky.")}}else{e(this).addClass("original").clone().insertAfter(this).addClass("cloned").css("position","fixed").css("top",r.top+"px").css("margin-top","0").css("margin-left","0").css("z-index",r.zindex).removeClass("original").hide();checkElement=setInterval(function(){t(r.top,r.minscreenwidth,r.maxscreenwidth)},10)}return this}})(jQuery)
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: senff
|
|
3 |
Tags: plugin, sticky, menu, scroll, element
|
4 |
Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
5 |
Requires at least: 3.6
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,6 +40,10 @@ A little bit of basic HTML/CSS knowledge is required. You just need to know how
|
|
40 |
= I selected a class/ID in the settings screen, but the element doesn't stick when I scroll downs. Why not? =
|
41 |
Make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
|
42 |
|
|
|
|
|
|
|
|
|
43 |
= Still doesn't work. What could be wrong? =
|
44 |
Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that returns zero elements on the page, OR more than one, it will be shown.
|
45 |
|
@@ -49,7 +53,7 @@ The current version only allows one sticky element. Having more than one may clu
|
|
49 |
= I'll need more help please! =
|
50 |
The plugin's own page can be found [here](http://www.senff.com/plugins/sticky-anything-wp).
|
51 |
|
52 |
-
For any other issues, please use the [WordPress.org forum](https://wordpress.org/support/).
|
53 |
|
54 |
|
55 |
== Screenshots ==
|
@@ -59,6 +63,10 @@ For any other issues, please use the [WordPress.org forum](https://wordpress.org
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
62 |
= 1.1.3 =
|
63 |
* Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported.
|
64 |
|
@@ -77,17 +85,21 @@ For any other issues, please use the [WordPress.org forum](https://wordpress.org
|
|
77 |
|
78 |
== Upgrade Notice ==
|
79 |
|
|
|
|
|
|
|
|
|
80 |
= 1.1.3 =
|
81 |
* Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported.
|
82 |
|
83 |
= 1.1.2 =
|
84 |
-
Fixes element width calculation bug.
|
85 |
|
86 |
= 1.1.1 =
|
87 |
-
Fixes viewport calculation bug.
|
88 |
|
89 |
= 1.1 =
|
90 |
-
Added functionality: you can now set a minimum and/or maximum screen size where the element should be sticky (handy for responsive designs, should you not want your element to be sticky below or above certain screen sizes).
|
91 |
|
92 |
= 1.0 =
|
93 |
-
Initial release of the plugin.
|
3 |
Tags: plugin, sticky, menu, scroll, element
|
4 |
Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
5 |
Requires at least: 3.6
|
6 |
+
Tested up to: 4.1
|
7 |
+
Stable tag: 1.1.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
40 |
= I selected a class/ID in the settings screen, but the element doesn't stick when I scroll downs. Why not? =
|
41 |
Make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
|
42 |
|
43 |
+
= I'm having some issues on mobile (or other responsive themes).
|
44 |
+
Some themes use some JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn't exist in the HTML source code upon page load, but is created on the fly some time after the page is fully loaded. Since the Sticky Anything plugin only works with elements that are present in the HTML source code, this can cause issues.
|
45 |
+
There is an experimental version of the plugin that addresses this issue, but it is not public since most themes do not use this method (and other plugins may rely on having the sticky menu present before they load). If you are interested in trying this version, please get in touch with me through http://www.senff.com/ and I will be happy to provide you this version, along with some help.
|
46 |
+
|
47 |
= Still doesn't work. What could be wrong? =
|
48 |
Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that returns zero elements on the page, OR more than one, it will be shown.
|
49 |
|
53 |
= I'll need more help please! =
|
54 |
The plugin's own page can be found [here](http://www.senff.com/plugins/sticky-anything-wp).
|
55 |
|
56 |
+
For any other issues, please use the [WordPress.org forum](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll).
|
57 |
|
58 |
|
59 |
== Screenshots ==
|
63 |
|
64 |
== Changelog ==
|
65 |
|
66 |
+
= 1.1.4 =
|
67 |
+
* Ready for WordPress 4.1 (and TwentyFifteen).
|
68 |
+
* Fixes issue when element has padding in percentages.
|
69 |
+
|
70 |
= 1.1.3 =
|
71 |
* Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported.
|
72 |
|
85 |
|
86 |
== Upgrade Notice ==
|
87 |
|
88 |
+
= 1.1.4 =
|
89 |
+
* Ready for WordPress 4.1 (and TwentyFifteen).
|
90 |
+
* Fixes issue when element has padding in percentages.
|
91 |
+
|
92 |
= 1.1.3 =
|
93 |
* Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported.
|
94 |
|
95 |
= 1.1.2 =
|
96 |
+
* Fixes element width calculation bug.
|
97 |
|
98 |
= 1.1.1 =
|
99 |
+
* Fixes viewport calculation bug.
|
100 |
|
101 |
= 1.1 =
|
102 |
+
* Added functionality: you can now set a minimum and/or maximum screen size where the element should be sticky (handy for responsive designs, should you not want your element to be sticky below or above certain screen sizes).
|
103 |
|
104 |
= 1.0 =
|
105 |
+
* Initial release of the plugin.
|
sticky-menu-or-anything.php
CHANGED
@@ -5,17 +5,17 @@ Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
|
5 |
Description: Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.
|
6 |
Author: Mark Senff
|
7 |
Author URI: http://www.senff.com
|
8 |
-
Version: 1.1.
|
9 |
*/
|
10 |
|
11 |
-
defined('ABSPATH') or die('
|
12 |
|
13 |
|
14 |
// === FUNCTIONS =========================================================================================================
|
15 |
|
16 |
if (!function_exists('sticky_anthing_default_options')) {
|
17 |
function sticky_anthing_default_options() {
|
18 |
-
$versionNum = '1.1.
|
19 |
if (get_option('sticky_anything_options') === false) {
|
20 |
$new_options['sa_version'] = $versionNum;
|
21 |
$new_options['sa_element'] = '';
|
@@ -31,7 +31,7 @@ if (!function_exists('sticky_anthing_default_options')) {
|
|
31 |
|
32 |
if (!function_exists('sticky_anything_update')) {
|
33 |
function sticky_anything_update() {
|
34 |
-
$versionNum = '1.1.
|
35 |
$existing_options = get_option('sticky_anything_options');
|
36 |
|
37 |
if(!isset($existing_options['sa_minscreenwidth'])) {
|
@@ -255,7 +255,7 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
255 |
|
256 |
<hr />
|
257 |
|
258 |
-
<p><a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">Sticky Menu (or Anything!) on Scroll</a> version 1.1.
|
259 |
|
260 |
</div>
|
261 |
|
5 |
Description: Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.
|
6 |
Author: Mark Senff
|
7 |
Author URI: http://www.senff.com
|
8 |
+
Version: 1.1.4
|
9 |
*/
|
10 |
|
11 |
+
defined('ABSPATH') or die('INSERT COIN');
|
12 |
|
13 |
|
14 |
// === FUNCTIONS =========================================================================================================
|
15 |
|
16 |
if (!function_exists('sticky_anthing_default_options')) {
|
17 |
function sticky_anthing_default_options() {
|
18 |
+
$versionNum = '1.1.4';
|
19 |
if (get_option('sticky_anything_options') === false) {
|
20 |
$new_options['sa_version'] = $versionNum;
|
21 |
$new_options['sa_element'] = '';
|
31 |
|
32 |
if (!function_exists('sticky_anything_update')) {
|
33 |
function sticky_anything_update() {
|
34 |
+
$versionNum = '1.1.4';
|
35 |
$existing_options = get_option('sticky_anything_options');
|
36 |
|
37 |
if(!isset($existing_options['sa_minscreenwidth'])) {
|
255 |
|
256 |
<hr />
|
257 |
|
258 |
+
<p><a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">Sticky Menu (or Anything!) on Scroll</a> version 1.1.4 by <a href="http://www.senff.com" target="_blank">Senff</a> / <a href="http://www.senff.com/contact" target="_blank">Please Report Bugs</a> / Follow on Twitter: <a href="http://www.twitter.com/senff" target="_blank">@Senff</a> / <a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">Detailed documentation</a> / <a href="http://www.senff.com/plugins/sticky-anything" target="_blank">Non-WP jQuery plugin</a></p>
|
259 |
|
260 |
</div>
|
261 |
|