Version Description
Download this release
Release Info
Developer | damiroquai |
Plugin | myStickymenu |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 1.5
- mystickymenu.js +26 -13
- mystickymenu.php +109 -126
- readme.txt +2 -2
mystickymenu.js
CHANGED
@@ -2,26 +2,39 @@
|
|
2 |
var mysticky_navbar = document.querySelector(mysticky_name.mysticky_string);
|
3 |
|
4 |
// add mysticky_wrap div around selected mysticky class
|
5 |
-
var
|
6 |
-
var
|
7 |
var position = 0;
|
8 |
-
for(var i = 0; i <
|
9 |
-
if(
|
10 |
position = i;
|
11 |
break;
|
12 |
};
|
13 |
};
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
// add myfixed class to
|
21 |
-
var origOffsetY = mysticky_navbar.offsetTop + 100;
|
22 |
var hasScrollY = 'scrollY' in window;
|
23 |
function onScroll(e) {
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
|
|
27 |
document.addEventListener('scroll', onScroll);
|
2 |
var mysticky_navbar = document.querySelector(mysticky_name.mysticky_string);
|
3 |
|
4 |
// add mysticky_wrap div around selected mysticky class
|
5 |
+
var parentmysticky = mysticky_navbar.parentNode;
|
6 |
+
var wrappermysticky = document.createElement('div');
|
7 |
var position = 0;
|
8 |
+
for(var i = 0; i < parentmysticky.childNodes.length; i++) {
|
9 |
+
if(parentmysticky.childNodes[i] == mysticky_navbar) {
|
10 |
position = i;
|
11 |
break;
|
12 |
};
|
13 |
};
|
14 |
+
wrappermysticky.id = 'mysticky-wrap';
|
15 |
+
wrappermysticky.appendChild(mysticky_navbar);
|
16 |
+
parentmysticky.insertBefore(wrappermysticky, parentmysticky.childNodes[position]);
|
17 |
+
|
18 |
+
// add mysticky_nav div inside selected mysticky class
|
19 |
+
var parentnav = mysticky_navbar.parentNode;
|
20 |
+
var wrappernav = document.createElement('div');
|
21 |
+
wrappernav.id = 'mysticky-nav';
|
22 |
+
parentnav.replaceChild(wrappernav, mysticky_navbar);
|
23 |
+
wrappernav.appendChild(mysticky_navbar);
|
24 |
|
25 |
+
// add myfixed and wrapfixed class to divs while scroll
|
26 |
+
var origOffsetY = mysticky_navbar.offsetTop + 100 ;
|
27 |
var hasScrollY = 'scrollY' in window;
|
28 |
function onScroll(e) {
|
29 |
+
var mydivWidth = ((mysticky_navbar.offsetWidth) + 'px');
|
30 |
+
var mydivHeight = ((mysticky_navbar.offsetHeight) + 'px');
|
31 |
+
var mydivReset = '';
|
32 |
+
// mysticky_navbar.style.width = mydivWidth;
|
33 |
+
var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
|
34 |
+
y >= origOffsetY ? mysticky_navbar.classList.add('myfixed') : mysticky_navbar.classList.remove('myfixed');
|
35 |
+
y >= origOffsetY ? wrappernav.classList.add('wrapfixed') : wrappernav.classList.remove('wrapfixed');
|
36 |
+
y >= origOffsetY ? mysticky_navbar.style.width = mydivWidth : mysticky_navbar.style.width = mydivReset;
|
37 |
+
y >= origOffsetY ? wrappermysticky.style.height = mydivHeight : wrappermysticky.style.height = mydivReset;
|
38 |
}
|
39 |
+
|
40 |
document.addEventListener('scroll', onScroll);
|
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.
|
7 |
Author: m.r.d.a
|
8 |
License: GPLv2 or later
|
9 |
*/
|
@@ -67,38 +67,12 @@ class MyStickyMenuPage
|
|
67 |
<?php
|
68 |
}
|
69 |
|
70 |
-
/**
|
71 |
-
* Load Defaults
|
72 |
-
*/
|
73 |
-
public function mysticky_default_options() {
|
74 |
-
|
75 |
-
global $options;
|
76 |
-
|
77 |
-
if ( false === get_option('mysticky_option_name') ) {
|
78 |
-
|
79 |
-
$default = array(
|
80 |
-
|
81 |
-
'mysticky_class_selector' => '.navbar',
|
82 |
-
'myfixed_zindex' => '1000000',
|
83 |
-
'myfixed_width' => '100%',
|
84 |
-
'myfixed_bgcolor' => '#F39A30',
|
85 |
-
'myfixed_opacity' => '95',
|
86 |
-
'myfixed_transition_time' => '0.3',
|
87 |
-
'myfixed_fade' => false,
|
88 |
-
'myfixed_disable_small_screen' => false,
|
89 |
-
'myfixed_disable_admin_bar' => false
|
90 |
-
|
91 |
-
);
|
92 |
-
|
93 |
-
add_option( 'mysticky_option_name', $default );
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
/**
|
98 |
* Register and add settings
|
99 |
*/
|
100 |
public function page_init()
|
101 |
{
|
|
|
102 |
register_setting(
|
103 |
'mysticky_option_group', // Option group
|
104 |
'mysticky_option_name', // Option name
|
@@ -130,14 +104,6 @@ class MyStickyMenuPage
|
|
130 |
'setting_section_id'
|
131 |
);
|
132 |
|
133 |
-
add_settings_field(
|
134 |
-
'myfixed_width',
|
135 |
-
'Sticky Width',
|
136 |
-
array( $this, 'myfixed_width_callback' ),
|
137 |
-
'my-stickymenu-settings',
|
138 |
-
'setting_section_id'
|
139 |
-
);
|
140 |
-
|
141 |
add_settings_field(
|
142 |
'myfixed_bgcolor',
|
143 |
'Sticky Background Color',
|
@@ -161,27 +127,29 @@ class MyStickyMenuPage
|
|
161 |
'my-stickymenu-settings',
|
162 |
'setting_section_id'
|
163 |
);
|
164 |
-
|
165 |
-
'myfixed_fade',
|
166 |
-
'Fade or slide effect',
|
167 |
-
array( $this, 'myfixed_fade_callback' ),
|
168 |
-
'my-stickymenu-settings',
|
169 |
-
'setting_section_id'
|
170 |
-
);
|
171 |
add_settings_field(
|
172 |
'myfixed_disable_small_screen',
|
173 |
-
'
|
174 |
array( $this, 'myfixed_disable_small_screen_callback' ),
|
175 |
'my-stickymenu-settings',
|
176 |
'setting_section_id'
|
177 |
);
|
178 |
add_settings_field(
|
179 |
-
'
|
180 |
-
'
|
181 |
-
array( $this, '
|
182 |
'my-stickymenu-settings',
|
183 |
'setting_section_id'
|
|
|
184 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
|
187 |
/**
|
@@ -198,9 +166,6 @@ class MyStickyMenuPage
|
|
198 |
if( isset( $input['myfixed_zindex'] ) )
|
199 |
$new_input['myfixed_zindex'] = absint( $input['myfixed_zindex'] );
|
200 |
|
201 |
-
if( isset( $input['myfixed_width'] ) )
|
202 |
-
$new_input['myfixed_width'] = sanitize_text_field( $input['myfixed_width'] );
|
203 |
-
|
204 |
if( isset( $input['myfixed_bgcolor'] ) )
|
205 |
$new_input['myfixed_bgcolor'] = sanitize_text_field( $input['myfixed_bgcolor'] );
|
206 |
|
@@ -210,57 +175,79 @@ class MyStickyMenuPage
|
|
210 |
if( isset( $input['myfixed_transition_time'] ) )
|
211 |
$new_input['myfixed_transition_time'] = sanitize_text_field( $input['myfixed_transition_time'] );
|
212 |
|
213 |
-
if( isset( $input['myfixed_fade'] ) )
|
214 |
-
$new_input['myfixed_fade'] = sanitize_text_field( $input['myfixed_fade'] );
|
215 |
-
|
216 |
if( isset( $input['myfixed_disable_small_screen'] ) )
|
217 |
-
$new_input['myfixed_disable_small_screen'] =
|
218 |
-
|
219 |
-
if( isset( $input['
|
220 |
-
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
222 |
return $new_input;
|
223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
/**
|
226 |
* Print the Section text
|
227 |
*/
|
|
|
228 |
public function print_section_info()
|
229 |
{
|
230 |
-
print '
|
231 |
}
|
232 |
-
|
233 |
/**
|
234 |
* Get the settings option array and print one of its values
|
235 |
*/
|
|
|
236 |
public function mysticky_class_selector_callback()
|
237 |
{
|
238 |
printf(
|
239 |
-
'<input type="text" id="mysticky_class_selector" name="mysticky_option_name[mysticky_class_selector]" value="%s" />
|
240 |
isset( $this->options['mysticky_class_selector'] ) ? esc_attr( $this->options['mysticky_class_selector']) : ''
|
241 |
);
|
242 |
}
|
243 |
-
|
244 |
public function myfixed_zindex_callback()
|
245 |
{
|
246 |
printf(
|
247 |
-
'<input type="text" id="myfixed_zindex" name="mysticky_option_name[myfixed_zindex]" value="%s" /> sticky z-index
|
248 |
isset( $this->options['myfixed_zindex'] ) ? esc_attr( $this->options['myfixed_zindex']) : ''
|
249 |
);
|
250 |
}
|
251 |
|
252 |
-
public function myfixed_width_callback()
|
253 |
-
{
|
254 |
-
printf(
|
255 |
-
'<input type="text" id="myfixed_width" name="mysticky_option_name[myfixed_width]" value="%s" /> sticky width in px or percentage' ,
|
256 |
-
isset( $this->options['myfixed_width'] ) ? esc_attr( $this->options['myfixed_width']) : ''
|
257 |
-
);
|
258 |
-
}
|
259 |
-
|
260 |
public function myfixed_bgcolor_callback()
|
261 |
{
|
262 |
printf(
|
263 |
-
'<input type="text" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" value="%s" />
|
264 |
isset( $this->options['myfixed_bgcolor'] ) ? esc_attr( $this->options['myfixed_bgcolor']) : ''
|
265 |
);
|
266 |
}
|
@@ -268,7 +255,7 @@ class MyStickyMenuPage
|
|
268 |
public function myfixed_opacity_callback()
|
269 |
{
|
270 |
printf(
|
271 |
-
'<input type="text" id="myfixed_opacity" name="mysticky_option_name[myfixed_opacity]" value="%s" /> numbers 1-100
|
272 |
isset( $this->options['myfixed_opacity'] ) ? esc_attr( $this->options['myfixed_opacity']) : ''
|
273 |
);
|
274 |
}
|
@@ -276,36 +263,39 @@ class MyStickyMenuPage
|
|
276 |
public function myfixed_transition_time_callback()
|
277 |
{
|
278 |
printf(
|
279 |
-
'<input type="text" id="myfixed_transition_time" name="mysticky_option_name[myfixed_transition_time]" value="%s" /> in seconds
|
280 |
isset( $this->options['myfixed_transition_time'] ) ? esc_attr( $this->options['myfixed_transition_time']) : ''
|
281 |
);
|
282 |
}
|
283 |
|
284 |
-
public function myfixed_fade_callback()
|
285 |
-
{
|
286 |
-
printf(
|
287 |
-
'<input id="%1$s" name="mysticky_option_name[myfixed_fade]" type="checkbox" %2$s /> Checked is fade, unchecked is slide.',
|
288 |
-
'myfixed_fade',
|
289 |
-
checked( isset( $this->options['myfixed_fade'] ), true, false )
|
290 |
-
);
|
291 |
-
}
|
292 |
-
|
293 |
public function myfixed_disable_small_screen_callback()
|
294 |
{
|
295 |
printf(
|
296 |
-
|
297 |
-
|
298 |
-
checked( isset( $this->options['myfixed_disable_small_screen'] ), true, false )
|
299 |
);
|
300 |
}
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
{
|
303 |
printf(
|
304 |
-
'<input id="%1$s" name="mysticky_option_name[
|
305 |
-
'
|
306 |
-
checked( isset( $this->options['
|
307 |
);
|
308 |
}
|
|
|
309 |
}
|
310 |
|
311 |
if( is_admin() )
|
@@ -331,53 +321,46 @@ add_filter('the_content_more_link', 'mysticky_remove_more_jump_link');
|
|
331 |
// Create style from options
|
332 |
|
333 |
function mysticky_build_stylesheet_content() {
|
|
|
334 |
$mysticky_options = get_option( 'mysticky_option_name' );
|
|
|
335 |
echo
|
336 |
-
|
337 |
-
if
|
338 |
-
|
339 |
-
' #wpadminbar { position: absolute !important; top: 0px !important;}
|
340 |
-
';
|
341 |
}
|
342 |
-
|
343 |
-
'
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
margin-top: 0px!important;
|
348 |
-
z-index: '. $mysticky_options ['myfixed_zindex'] .';
|
349 |
-
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . $mysticky_options ['myfixed_opacity'] . ')";
|
350 |
-
filter: alpha(opacity=' . $mysticky_options ['myfixed_opacity'] . ');
|
351 |
-
opacity:.' . $mysticky_options ['myfixed_opacity'] . ';
|
352 |
-
';
|
353 |
-
if ($mysticky_options ['myfixed_width'] >= 1 ){
|
354 |
-
echo
|
355 |
-
' width:' . $mysticky_options ['myfixed_width'] . '!important;
|
356 |
-
|
357 |
-
';
|
358 |
}
|
|
|
359 |
echo
|
360 |
-
|
361 |
-
|
362 |
-
-moz-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
363 |
-
-o-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
364 |
-
transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
365 |
-
}
|
366 |
-
';
|
367 |
-
if ($mysticky_options ['myfixed_disable_small_screen'] == false ){
|
368 |
echo
|
369 |
-
'
|
370 |
-
';
|
|
|
|
|
|
|
371 |
}
|
372 |
echo
|
373 |
-
'
|
|
|
|
|
374 |
';
|
375 |
|
376 |
-
|
377 |
-
|
378 |
-
|
|
|
|
|
|
|
379 |
}
|
380 |
-
echo
|
|
|
381 |
';
|
382 |
}
|
383 |
add_action('wp_head', 'mysticky_build_stylesheet_content');
|
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.5
|
7 |
Author: m.r.d.a
|
8 |
License: GPLv2 or later
|
9 |
*/
|
67 |
<?php
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
/**
|
71 |
* Register and add settings
|
72 |
*/
|
73 |
public function page_init()
|
74 |
{
|
75 |
+
global $id, $title, $callback, $page;
|
76 |
register_setting(
|
77 |
'mysticky_option_group', // Option group
|
78 |
'mysticky_option_name', // Option name
|
104 |
'setting_section_id'
|
105 |
);
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
add_settings_field(
|
108 |
'myfixed_bgcolor',
|
109 |
'Sticky Background Color',
|
127 |
'my-stickymenu-settings',
|
128 |
'setting_section_id'
|
129 |
);
|
130 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
add_settings_field(
|
132 |
'myfixed_disable_small_screen',
|
133 |
+
'Disable at Small Screen Sizes',
|
134 |
array( $this, 'myfixed_disable_small_screen_callback' ),
|
135 |
'my-stickymenu-settings',
|
136 |
'setting_section_id'
|
137 |
);
|
138 |
add_settings_field(
|
139 |
+
'myfixed_cssstyle',
|
140 |
+
'.myfixed css class',
|
141 |
+
array( $this, 'myfixed_cssstyle_callback' ),
|
142 |
'my-stickymenu-settings',
|
143 |
'setting_section_id'
|
144 |
+
|
145 |
);
|
146 |
+
add_settings_field(
|
147 |
+
'myfixed_fade',
|
148 |
+
'Fade or slide effect',
|
149 |
+
array( $this, 'myfixed_fade_callback' ),
|
150 |
+
'my-stickymenu-settings',
|
151 |
+
'setting_section_id'
|
152 |
+
);
|
153 |
}
|
154 |
|
155 |
/**
|
166 |
if( isset( $input['myfixed_zindex'] ) )
|
167 |
$new_input['myfixed_zindex'] = absint( $input['myfixed_zindex'] );
|
168 |
|
|
|
|
|
|
|
169 |
if( isset( $input['myfixed_bgcolor'] ) )
|
170 |
$new_input['myfixed_bgcolor'] = sanitize_text_field( $input['myfixed_bgcolor'] );
|
171 |
|
175 |
if( isset( $input['myfixed_transition_time'] ) )
|
176 |
$new_input['myfixed_transition_time'] = sanitize_text_field( $input['myfixed_transition_time'] );
|
177 |
|
|
|
|
|
|
|
178 |
if( isset( $input['myfixed_disable_small_screen'] ) )
|
179 |
+
$new_input['myfixed_disable_small_screen'] = absint( $input['myfixed_disable_small_screen'] );
|
180 |
+
|
181 |
+
if( isset( $input['myfixed_cssstyle'] ) )
|
182 |
+
//$new_input['myfixed_cssstyle'] = esc_textarea( $input['myfixed_cssstyle'] );
|
183 |
+
$new_input['myfixed_cssstyle'] = sanitize_text_field( $input['myfixed_cssstyle'] );
|
184 |
+
|
185 |
+
if( isset( $input['myfixed_fade'] ) )
|
186 |
+
$new_input['myfixed_fade'] = sanitize_text_field( $input['myfixed_fade'] );
|
187 |
+
|
188 |
+
|
189 |
return $new_input;
|
190 |
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Load Defaults
|
194 |
+
*/
|
195 |
+
public function mysticky_default_options() {
|
196 |
+
|
197 |
+
global $options;
|
198 |
+
|
199 |
+
|
200 |
+
|
201 |
+
|
202 |
+
if ( get_option('mysticky_option_name') == false ) {
|
203 |
+
|
204 |
+
$default = array(
|
205 |
|
206 |
+
'mysticky_class_selector' => '.navbar',
|
207 |
+
'myfixed_zindex' => '1000000',
|
208 |
+
'myfixed_bgcolor' => '#F39A30',
|
209 |
+
'myfixed_opacity' => '95',
|
210 |
+
'myfixed_transition_time' => '0.3',
|
211 |
+
'myfixed_cssstyle' => '.myfixed {margin: 0 auto!important; float:none!important; border:0px!important; background:none!important;}',
|
212 |
+
'myfixed_disable_small_screen' => '359',
|
213 |
+
'myfixed_fade' => 'on'
|
214 |
+
);
|
215 |
+
|
216 |
+
update_option( 'mysticky_option_name', $default );
|
217 |
+
}
|
218 |
+
}
|
219 |
/**
|
220 |
* Print the Section text
|
221 |
*/
|
222 |
+
|
223 |
public function print_section_info()
|
224 |
{
|
225 |
+
print 'Add nice modern sticky menu or header to any theme. Defaults works for Twenty Thirteen theme. <br />For other themes change "Sticky Class" to div class desired to be sticky (div id can be used too).';
|
226 |
}
|
|
|
227 |
/**
|
228 |
* Get the settings option array and print one of its values
|
229 |
*/
|
230 |
+
|
231 |
public function mysticky_class_selector_callback()
|
232 |
{
|
233 |
printf(
|
234 |
+
'<p class="description"><input type="text" id="mysticky_class_selector" name="mysticky_option_name[mysticky_class_selector]" value="%s" /> menu or header div class or id.</p>',
|
235 |
isset( $this->options['mysticky_class_selector'] ) ? esc_attr( $this->options['mysticky_class_selector']) : ''
|
236 |
);
|
237 |
}
|
238 |
+
|
239 |
public function myfixed_zindex_callback()
|
240 |
{
|
241 |
printf(
|
242 |
+
'<p class="description"><input type="text" id="myfixed_zindex" name="mysticky_option_name[myfixed_zindex]" value="%s" /> sticky z-index.</p>',
|
243 |
isset( $this->options['myfixed_zindex'] ) ? esc_attr( $this->options['myfixed_zindex']) : ''
|
244 |
);
|
245 |
}
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
public function myfixed_bgcolor_callback()
|
248 |
{
|
249 |
printf(
|
250 |
+
'<p class="description"><input type="text" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" value="%s" /> full width background color.</p>' ,
|
251 |
isset( $this->options['myfixed_bgcolor'] ) ? esc_attr( $this->options['myfixed_bgcolor']) : ''
|
252 |
);
|
253 |
}
|
255 |
public function myfixed_opacity_callback()
|
256 |
{
|
257 |
printf(
|
258 |
+
'<p class="description"><input type="text" id="myfixed_opacity" name="mysticky_option_name[myfixed_opacity]" value="%s" /> numbers 1-100.</p>',
|
259 |
isset( $this->options['myfixed_opacity'] ) ? esc_attr( $this->options['myfixed_opacity']) : ''
|
260 |
);
|
261 |
}
|
263 |
public function myfixed_transition_time_callback()
|
264 |
{
|
265 |
printf(
|
266 |
+
'<p class="description"><input type="text" id="myfixed_transition_time" name="mysticky_option_name[myfixed_transition_time]" value="%s" /> in seconds.</p>',
|
267 |
isset( $this->options['myfixed_transition_time'] ) ? esc_attr( $this->options['myfixed_transition_time']) : ''
|
268 |
);
|
269 |
}
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
public function myfixed_disable_small_screen_callback()
|
272 |
{
|
273 |
printf(
|
274 |
+
'<p class="description">less than <input type="text" size="4" id="myfixed_disable_small_screen" name="mysticky_option_name[myfixed_disable_small_screen]" value="%s" /> px, 0 to disable.</p>',
|
275 |
+
isset( $this->options['myfixed_disable_small_screen'] ) ? esc_attr( $this->options['myfixed_disable_small_screen']) : ''
|
|
|
276 |
);
|
277 |
}
|
278 |
+
|
279 |
+
public function myfixed_cssstyle_callback()
|
280 |
+
|
281 |
+
{
|
282 |
+
printf(
|
283 |
+
'
|
284 |
+
<p class="description">Add/Edit .myfixed css class to change sticky menu style.Leave it blank for default style.</p> <textarea type="text" rows="4" cols="60" id="myfixed_cssstyle" name="mysticky_option_name[myfixed_cssstyle]">%s</textarea> <br /><p class="description">Default style: .myfixed {margin: 0 auto!important; float:none!important; border:0px!important; background:none!important; }<br /><br />If you want to change sticky hover color first add default style and than: .myfixed li a:hover {color:#000; background-color: #ccc;} .<br /> More examples <a href="http://wordpress.transformnews.com/tutorials/mystickymenu-extended-style-functionality-using-myfixed-sticky-class-403" target="blank">here</a>.</p>
|
285 |
+
' ,
|
286 |
+
isset( $this->options['myfixed_cssstyle'] ) ? esc_attr( $this->options['myfixed_cssstyle']) : ''
|
287 |
+
);
|
288 |
+
}
|
289 |
+
|
290 |
+
public function myfixed_fade_callback()
|
291 |
{
|
292 |
printf(
|
293 |
+
'<p class="description"><input id="%1$s" name="mysticky_option_name[myfixed_fade]" type="checkbox" %2$s /> Checked is fade, unchecked is slide.</p>',
|
294 |
+
'myfixed_fade',
|
295 |
+
checked( isset( $this->options['myfixed_fade'] ), true, false )
|
296 |
);
|
297 |
}
|
298 |
+
|
299 |
}
|
300 |
|
301 |
if( is_admin() )
|
321 |
// Create style from options
|
322 |
|
323 |
function mysticky_build_stylesheet_content() {
|
324 |
+
|
325 |
$mysticky_options = get_option( 'mysticky_option_name' );
|
326 |
+
|
327 |
echo
|
328 |
+
'<style type="text/css">';
|
329 |
+
if ( is_user_logged_in() ) {
|
330 |
+
echo '#wpadminbar { position: absolute !important; top: 0px !important;}';
|
|
|
|
|
331 |
}
|
332 |
+
|
333 |
+
if ( $mysticky_options['myfixed_cssstyle'] == "" ) {
|
334 |
+
|
335 |
+
echo '.myfixed { margin:0 auto!important; float:none!important; border:0px!important; background:none!important; max-width:100%!important; }';
|
336 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
}
|
338 |
+
|
339 |
echo
|
340 |
+
$mysticky_options ['myfixed_cssstyle'] ;
|
341 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
echo
|
343 |
+
'
|
344 |
+
#mysticky-nav { width:100%!important; position: static;';
|
345 |
+
if (!isset($mysticky_options['myfixed_fade'])){
|
346 |
+
echo
|
347 |
+
'top: -100px;';
|
348 |
}
|
349 |
echo
|
350 |
+
'}';
|
351 |
+
echo
|
352 |
+
'.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; }
|
353 |
';
|
354 |
|
355 |
+
|
356 |
+
|
357 |
+
if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
|
358 |
+
echo
|
359 |
+
'@media (max-width: ' . $mysticky_options ['myfixed_disable_small_screen'] . 'px) {.wrapfixed {position: static!important;}}
|
360 |
+
';
|
361 |
}
|
362 |
+
echo
|
363 |
+
'</style>
|
364 |
';
|
365 |
}
|
366 |
add_action('wp_head', 'mysticky_build_stylesheet_content');
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: damiroquai
|
|
3 |
Donate link: http://wordpress.transformnews.com
|
4 |
Tags: sticky menu, twentythirteen, twenty-thirteen, plugin, menu
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 3.9
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
This lightweight plugin will made your menu sticky on top of page, after scroll, when selected sticky class hits upper border.
|
3 |
Donate link: http://wordpress.transformnews.com
|
4 |
Tags: sticky menu, twentythirteen, twenty-thirteen, plugin, menu
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 3.9.1
|
7 |
+
Stable tag: 1.5
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
This lightweight plugin will made your menu sticky on top of page, after scroll, when selected sticky class hits upper border.
|