Version Description
- Added functionality for optional minimum/maximum screen size
Download this release
Release Info
Developer | senff |
Plugin | Sticky Menu (or Anything!) on Scroll |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.1
- README.md +8 -1
- assets/js/jq-sticky-anything.js +6 -3
- assets/js/jq-sticky-anything.min.js +1 -1
- assets/js/stickThis.js +3 -0
- readme.txt +8 -1
- sticky-menu-or-anything.php +86 -8
README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
5 |
* Requires at least: 3.6
|
6 |
* Tested up to: 4.0
|
7 |
-
* Stable tag: 1.
|
8 |
* License: GPLv2 or later
|
9 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -22,6 +22,7 @@ A little bit of basic HTML/CSS knowledge is required. You just need to know how
|
|
22 |
|
23 |
* **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
|
24 |
* **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
|
|
|
25 |
* **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
|
26 |
* **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
|
27 |
|
@@ -58,11 +59,17 @@ For any other issues, please use the [WordPress.org forum](https://wordpress.org
|
|
58 |
|
59 |
## Changelog
|
60 |
|
|
|
|
|
|
|
61 |
### 1.0
|
62 |
* initial release (using v1.1 of the standalone jQuery plugin)
|
63 |
|
64 |
|
65 |
## Upgrade Notice
|
66 |
|
|
|
|
|
|
|
67 |
### 1.0
|
68 |
Initial release of the plugin
|
4 |
* Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
5 |
* Requires at least: 3.6
|
6 |
* Tested up to: 4.0
|
7 |
+
* Stable tag: 1.1
|
8 |
* License: GPLv2 or later
|
9 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
22 |
|
23 |
* **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
|
24 |
* **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
|
25 |
+
* **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
|
26 |
* **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
|
27 |
* **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
|
28 |
|
59 |
|
60 |
## Changelog
|
61 |
|
62 |
+
### 1.1
|
63 |
+
* Added functionality for optional minimum/maximum screen size
|
64 |
+
|
65 |
### 1.0
|
66 |
* initial release (using v1.1 of the standalone jQuery plugin)
|
67 |
|
68 |
|
69 |
## Upgrade Notice
|
70 |
|
71 |
+
### 1.1
|
72 |
+
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).
|
73 |
+
|
74 |
### 1.0
|
75 |
Initial release of the plugin
|
assets/js/jq-sticky-anything.js
CHANGED
@@ -9,6 +9,8 @@
|
|
9 |
var settings = $.extend({
|
10 |
// Default
|
11 |
top: 0,
|
|
|
|
|
12 |
zindex: 1,
|
13 |
debugmode: false
|
14 |
}, options );
|
@@ -31,19 +33,20 @@
|
|
31 |
} else {
|
32 |
// Create a clone of the menu, right next to original (in the DOM).
|
33 |
$(this).addClass('original').clone().insertAfter(this).addClass('cloned').css('position','fixed').css('top',settings.top+'px').css('margin-top','0').css('margin-left','0').css('z-index',settings.zindex).removeClass('original').hide();
|
34 |
-
checkElement = setInterval(function(){stickIt(settings.top)},10);
|
35 |
}
|
36 |
|
37 |
return this;
|
38 |
};
|
39 |
|
40 |
|
41 |
-
function stickIt(stickyTop) {
|
42 |
|
43 |
var orgElementPos = $('.original').offset();
|
44 |
orgElementTop = orgElementPos.top;
|
45 |
|
46 |
-
if ($(window).scrollTop() >= (orgElementTop - stickyTop)) {
|
|
|
47 |
// scrolled past the original position; now only show the cloned, sticky element.
|
48 |
|
49 |
// Cloned element should always have same left position and width as original element.
|
9 |
var settings = $.extend({
|
10 |
// Default
|
11 |
top: 0,
|
12 |
+
minscreenwidth: 0,
|
13 |
+
maxscreenwidth: 99999,
|
14 |
zindex: 1,
|
15 |
debugmode: false
|
16 |
}, options );
|
33 |
} else {
|
34 |
// Create a clone of the menu, right next to original (in the DOM).
|
35 |
$(this).addClass('original').clone().insertAfter(this).addClass('cloned').css('position','fixed').css('top',settings.top+'px').css('margin-top','0').css('margin-left','0').css('z-index',settings.zindex).removeClass('original').hide();
|
36 |
+
checkElement = setInterval(function(){stickIt(settings.top,settings.minscreenwidth,settings.maxscreenwidth)},10);
|
37 |
}
|
38 |
|
39 |
return this;
|
40 |
};
|
41 |
|
42 |
|
43 |
+
function stickIt(stickyTop,minwidth,maxwidth) {
|
44 |
|
45 |
var orgElementPos = $('.original').offset();
|
46 |
orgElementTop = orgElementPos.top;
|
47 |
|
48 |
+
if (($(window).scrollTop() >= (orgElementTop - stickyTop)) && ($(window).width() > minwidth) && ($(window).width() < maxwidth)) {
|
49 |
+
|
50 |
// scrolled past the original position; now only show the cloned, sticky element.
|
51 |
|
52 |
// Cloned element should always have same left position and width as original element.
|
assets/js/jq-sticky-anything.min.js
CHANGED
@@ -2,4 +2,4 @@
|
|
2 |
* @preserve Sticky Anything 1.1 | @senff | GPL2 Licensed
|
3 |
*/
|
4 |
|
5 |
-
(function(e){function t(t){var
|
2 |
* @preserve Sticky Anything 1.1 | @senff | GPL2 Licensed
|
3 |
*/
|
4 |
|
5 |
+
(function(e){function t(t,n,r){var i=e(".original").offset();orgElementTop=i.top;if(e(window).scrollTop()>=orgElementTop-t&&e(window).width()>n&&e(window).width()<r){orgElement=e(".original");coordsOrgElement=orgElement.offset();leftOrgElement=coordsOrgElement.left;widthOrgElement=orgElement.width();e(".cloned").css("left",leftOrgElement+"px").css("top",t+"px").css("width",widthOrgElement+"px").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)
|
assets/js/stickThis.js
CHANGED
@@ -1,8 +1,11 @@
|
|
1 |
(function($) {
|
2 |
$(document).ready(function($) {
|
3 |
|
|
|
4 |
$(sticky_anything_engage.element).stickThis({
|
5 |
top:sticky_anything_engage.topspace,
|
|
|
|
|
6 |
zindex:sticky_anything_engage.zindex,
|
7 |
debugmode:sticky_anything_engage.debugmode
|
8 |
});
|
1 |
(function($) {
|
2 |
$(document).ready(function($) {
|
3 |
|
4 |
+
|
5 |
$(sticky_anything_engage.element).stickThis({
|
6 |
top:sticky_anything_engage.topspace,
|
7 |
+
minscreenwidth:sticky_anything_engage.minscreenwidth,
|
8 |
+
maxscreenwidth:sticky_anything_engage.maxscreenwidth,
|
9 |
zindex:sticky_anything_engage.zindex,
|
10 |
debugmode:sticky_anything_engage.debugmode
|
11 |
});
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.0
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -22,6 +22,7 @@ A little bit of basic HTML/CSS knowledge is required. You just need to know how
|
|
22 |
|
23 |
* **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
|
24 |
* **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
|
|
|
25 |
* **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
|
26 |
* **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
|
27 |
|
@@ -58,11 +59,17 @@ For any other issues, please use the [WordPress.org forum](https://wordpress.org
|
|
58 |
|
59 |
== Changelog ==
|
60 |
|
|
|
|
|
|
|
61 |
= 1.0 =
|
62 |
* initial release (using v1.1 of the standalone jQuery plugin)
|
63 |
|
64 |
|
65 |
== Upgrade Notice ==
|
66 |
|
|
|
|
|
|
|
67 |
= 1.0 =
|
68 |
Initial release of the plugin
|
4 |
Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 1.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
22 |
|
23 |
* **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
|
24 |
* **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
|
25 |
+
* **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
|
26 |
* **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
|
27 |
* **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
|
28 |
|
59 |
|
60 |
== Changelog ==
|
61 |
|
62 |
+
= 1.1 =
|
63 |
+
* Added functionality for optional minimum/maximum screen size
|
64 |
+
|
65 |
= 1.0 =
|
66 |
* initial release (using v1.1 of the standalone jQuery plugin)
|
67 |
|
68 |
|
69 |
== Upgrade Notice ==
|
70 |
|
71 |
+
= 1.1 =
|
72 |
+
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).
|
73 |
+
|
74 |
= 1.0 =
|
75 |
Initial release of the plugin
|
sticky-menu-or-anything.php
CHANGED
@@ -5,7 +5,7 @@ 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.
|
9 |
*/
|
10 |
|
11 |
defined('ABSPATH') or die('Gorgonzola. Wow, BOB, wow.');
|
@@ -15,19 +15,33 @@ defined('ABSPATH') or die('Gorgonzola. Wow, BOB, wow.');
|
|
15 |
|
16 |
if (!function_exists('sticky_anthing_default_options')) {
|
17 |
function sticky_anthing_default_options() {
|
18 |
-
$versionNum = '
|
19 |
if (get_option('sticky_anything_options') === false) {
|
20 |
$new_options['sa_version'] = $versionNum;
|
21 |
$new_options['sa_element'] = '';
|
22 |
$new_options['sa_topspace'] = '';
|
|
|
|
|
23 |
$new_options['sa_zindex'] = '';
|
24 |
$new_options['sa_debugmode'] = false;
|
25 |
add_option('sticky_anything_options',$new_options);
|
26 |
-
}
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
}
|
33 |
|
@@ -46,6 +60,14 @@ if (!function_exists('load_sticky_anything')) {
|
|
46 |
$options['sa_topspace'] = '0';
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
if (!$options['sa_zindex']) {
|
50 |
$options['sa_zindex'] = '1';
|
51 |
}
|
@@ -53,6 +75,8 @@ if (!function_exists('load_sticky_anything')) {
|
|
53 |
$script_vars = array(
|
54 |
'element' => $options['sa_element'],
|
55 |
'topspace' => $options['sa_topspace'],
|
|
|
|
|
56 |
'zindex' => $options['sa_zindex'],
|
57 |
'debugmode' => $options['sa_debugmode']
|
58 |
);
|
@@ -103,6 +127,21 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
103 |
$warnings = true;
|
104 |
}
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
|
107 |
// Z-index is not empty and has bad value
|
108 |
$warnings = true;
|
@@ -121,6 +160,18 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
121 |
echo '<li><strong>TOP POSITION</strong> has to be a number (do not include "px" or "pixels", or any other characters).</li>';
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
|
125 |
echo '<li><strong>Z-INDEX</strong> has to be a number (do not include any other characters).</li>';
|
126 |
}
|
@@ -161,6 +212,20 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
161 |
</td>
|
162 |
</tr>
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
<tr>
|
165 |
<th scope="row">Z-index: (optional) <a href="#" title="If there are other elements on the page that obscure/overlap the sticky element, adding a Z-index might help. If you have no idea what that means, try entering 99999." class="help">?</a></th>
|
166 |
<td>
|
@@ -190,7 +255,7 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
190 |
|
191 |
<hr />
|
192 |
|
193 |
-
<p><a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">Sticky Menu (or Anything!) on Scroll</a> version 1.
|
194 |
|
195 |
</div>
|
196 |
|
@@ -227,6 +292,18 @@ if (!function_exists('process_sticky_anything_options')) {
|
|
227 |
}
|
228 |
}
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
foreach ( array('sa_zindex') as $option_name ) {
|
231 |
if ( isset( $_POST[$option_name] ) ) {
|
232 |
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
@@ -256,6 +333,7 @@ if (!function_exists('process_sticky_anything_options')) {
|
|
256 |
// === HOOKS AND ACTIONS ==================================================================================
|
257 |
|
258 |
register_activation_hook( __FILE__, 'sticky_anthing_default_options' );
|
|
|
259 |
add_action('wp_enqueue_scripts', 'load_sticky_anything');
|
260 |
add_action('admin_menu', 'sticky_anything_menu');
|
261 |
add_action('admin_init', 'sticky_anything_admin_init' );
|
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('Gorgonzola. Wow, BOB, wow.');
|
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'] = '';
|
22 |
$new_options['sa_topspace'] = '';
|
23 |
+
$new_options['sa_minscreenwidth'] = '';
|
24 |
+
$new_options['sa_maxscreenwidth'] = '';
|
25 |
$new_options['sa_zindex'] = '';
|
26 |
$new_options['sa_debugmode'] = false;
|
27 |
add_option('sticky_anything_options',$new_options);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
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'])) {
|
38 |
+
// Introduced in version 1.1
|
39 |
+
$existing_options['sa_minscreenwidth'] = '';
|
40 |
+
$existing_options['sa_maxscreenwidth'] = '';
|
41 |
+
}
|
42 |
+
|
43 |
+
$existing_options['sa_version'] = $versionNum;
|
44 |
+
update_option('sticky_anything_options',$existing_options);
|
45 |
}
|
46 |
}
|
47 |
|
60 |
$options['sa_topspace'] = '0';
|
61 |
}
|
62 |
|
63 |
+
if (!$options['sa_minscreenwidth']) {
|
64 |
+
$options['sa_minscreenwidth'] = '0';
|
65 |
+
}
|
66 |
+
|
67 |
+
if (!$options['sa_maxscreenwidth']) {
|
68 |
+
$options['sa_maxscreenwidth'] = '999999';
|
69 |
+
}
|
70 |
+
|
71 |
if (!$options['sa_zindex']) {
|
72 |
$options['sa_zindex'] = '1';
|
73 |
}
|
75 |
$script_vars = array(
|
76 |
'element' => $options['sa_element'],
|
77 |
'topspace' => $options['sa_topspace'],
|
78 |
+
'minscreenwidth' => $options['sa_minscreenwidth'],
|
79 |
+
'maxscreenwidth' => $options['sa_maxscreenwidth'],
|
80 |
'zindex' => $options['sa_zindex'],
|
81 |
'debugmode' => $options['sa_debugmode']
|
82 |
);
|
127 |
$warnings = true;
|
128 |
}
|
129 |
|
130 |
+
if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {
|
131 |
+
// Minimum width is not empty and has bad value
|
132 |
+
$warnings = true;
|
133 |
+
}
|
134 |
+
|
135 |
+
if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {
|
136 |
+
// Maximum width is not empty and has bad value
|
137 |
+
$warnings = true;
|
138 |
+
}
|
139 |
+
|
140 |
+
if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {
|
141 |
+
// Minimum width is larger than the maximum width
|
142 |
+
$warnings = true;
|
143 |
+
}
|
144 |
+
|
145 |
if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
|
146 |
// Z-index is not empty and has bad value
|
147 |
$warnings = true;
|
160 |
echo '<li><strong>TOP POSITION</strong> has to be a number (do not include "px" or "pixels", or any other characters).</li>';
|
161 |
}
|
162 |
|
163 |
+
if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {
|
164 |
+
echo '<li><strong>MINIMUM SCREEN WIDTH</strong> has to be a number (do not include "px" or "pixels", or any other characters).</li>';
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {
|
168 |
+
echo '<li><strong>MAXIMUM SCREEN WIDTH</strong> has to be a number (do not include "px" or "pixels", or any other characters).</li>';
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {
|
172 |
+
echo '<li><strong>MAXIMUM</strong> screen width has to have a larger value than the <strong>MINIMUM</strong> screen width.</li>';
|
173 |
+
}
|
174 |
+
|
175 |
if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
|
176 |
echo '<li><strong>Z-INDEX</strong> has to be a number (do not include any other characters).</li>';
|
177 |
}
|
212 |
</td>
|
213 |
</tr>
|
214 |
|
215 |
+
<tr>
|
216 |
+
<th scope="row">Element should not be sticky when screen smaller than: (optional) <a href="#" title="Sometimes you do not want your element to be sticky when your screen is small (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is smaller than this value." class="help">?</a></th>
|
217 |
+
<td>
|
218 |
+
<input type="number" id="sa_minscreenwidth" name="sa_minscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_minscreenwidth'] ); ?>" style="width:80px;" /> pixels
|
219 |
+
</td>
|
220 |
+
</tr>
|
221 |
+
|
222 |
+
<tr>
|
223 |
+
<th scope="row">Element should not be sticky when screen larger than: (optional) <a href="#" title="Sometimes you do not want your element to be sticky when your screen is large (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is wider than this value." class="help">?</a></th>
|
224 |
+
<td>
|
225 |
+
<input type="number" id="sa_maxscreenwidth" name="sa_maxscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_maxscreenwidth'] ); ?>" style="width:80px;" /> pixels
|
226 |
+
</td>
|
227 |
+
</tr>
|
228 |
+
|
229 |
<tr>
|
230 |
<th scope="row">Z-index: (optional) <a href="#" title="If there are other elements on the page that obscure/overlap the sticky element, adding a Z-index might help. If you have no idea what that means, try entering 99999." class="help">?</a></th>
|
231 |
<td>
|
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 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 |
|
292 |
}
|
293 |
}
|
294 |
|
295 |
+
foreach ( array('sa_minscreenwidth') as $option_name ) {
|
296 |
+
if ( isset( $_POST[$option_name] ) ) {
|
297 |
+
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
foreach ( array('sa_maxscreenwidth') as $option_name ) {
|
302 |
+
if ( isset( $_POST[$option_name] ) ) {
|
303 |
+
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
foreach ( array('sa_zindex') as $option_name ) {
|
308 |
if ( isset( $_POST[$option_name] ) ) {
|
309 |
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
333 |
// === HOOKS AND ACTIONS ==================================================================================
|
334 |
|
335 |
register_activation_hook( __FILE__, 'sticky_anthing_default_options' );
|
336 |
+
add_action('init','sticky_anything_update',1);
|
337 |
add_action('wp_enqueue_scripts', 'load_sticky_anything');
|
338 |
add_action('admin_menu', 'sticky_anything_menu');
|
339 |
add_action('admin_init', 'sticky_anything_admin_init' );
|