myStickymenu - Version 1.6

Version Description

  • Added: Make visible when scroled after number of pixels option.
  • Fixed opacity 100 bug.
Download this release

Release Info

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

Code changes from version 1.5 to 1.6

Files changed (5) hide show
  1. mystickymenu.js +12 -4
  2. mystickymenu.php +126 -72
  3. readme.txt +79 -9
  4. screenshot-1.png +0 -0
  5. screenshot-2.png +0 -0
mystickymenu.js CHANGED
@@ -1,3 +1,8 @@
1
// select mysticky class
2
var mysticky_navbar = document.querySelector(mysticky_name.mysticky_string);
3
@@ -23,13 +28,15 @@ 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');
@@ -37,4 +44,5 @@ var y = hasScrollY ? window.scrollY : document.documentElement.scrollTop;
37
y >= origOffsetY ? wrappermysticky.style.height = mydivHeight : wrappermysticky.style.height = mydivReset;
38
}
39
40
- document.addEventListener('scroll', onScroll);
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
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');
44
y >= origOffsetY ? wrappermysticky.style.height = mydivHeight : wrappermysticky.style.height = mydivReset;
45
}
46
47
+ document.addEventListener('scroll', onScroll);
48
+ };
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.5
7
Author: m.r.d.a
8
License: GPLv2 or later
9
*/
@@ -71,8 +71,8 @@ class MyStickyMenuPage
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
@@ -135,14 +135,15 @@ class MyStickyMenuPage
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',
@@ -150,6 +151,15 @@ class MyStickyMenuPage
150
'my-stickymenu-settings',
151
'setting_section_id'
152
);
153
}
154
155
/**
@@ -170,20 +180,23 @@ class MyStickyMenuPage
170
$new_input['myfixed_bgcolor'] = sanitize_text_field( $input['myfixed_bgcolor'] );
171
172
if( isset( $input['myfixed_opacity'] ) )
173
- $new_input['myfixed_opacity'] = sanitize_text_field( $input['myfixed_opacity'] );
174
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;
@@ -195,12 +208,8 @@ class MyStickyMenuPage
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',
@@ -208,14 +217,31 @@ class MyStickyMenuPage
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
*/
@@ -231,7 +257,7 @@ class MyStickyMenuPage
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
}
@@ -239,7 +265,7 @@ class MyStickyMenuPage
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
}
@@ -247,7 +273,7 @@ class MyStickyMenuPage
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,7 +281,7 @@ class MyStickyMenuPage
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,7 +289,7 @@ class MyStickyMenuPage
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
}
@@ -271,56 +297,71 @@ class MyStickyMenuPage
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() )
302
$my_settings_page = new MyStickyMenuPage();
303
304
- // end plugin admin settings
305
-
306
307
- // Remove default option for more link that jumps at the midle of page and its covered by menu
308
309
- function mysticky_remove_more_jump_link($link) {
310
- $offset = strpos($link, '#more-');
311
- if ($offset) {
312
- $end = strpos($link, '"',$offset);
313
- }
314
- if ($end) {
315
- $link = substr_replace($link, '', $offset, $end-$offset);
316
}
317
- return $link;
318
- }
319
- add_filter('the_content_more_link', 'mysticky_remove_more_jump_link');
320
321
- // Create style from options
322
323
- function mysticky_build_stylesheet_content() {
324
325
$mysticky_options = get_option( 'mysticky_option_name' );
326
@@ -329,56 +370,69 @@ function mysticky_build_stylesheet_content() {
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');
367
368
369
- function mystickymenu_script() {
370
371
$mysticky_options = get_option( 'mysticky_option_name' );
372
373
- // Register scripts
374
- wp_register_script('mystickymenu', WP_PLUGIN_URL. '/mystickymenu/mystickymenu.js', false,'1.0.0', true);
375
- wp_enqueue_script( 'mystickymenu' );
376
377
- // Localize mystickymenu.js script with myStickymenu options
378
- $mysticky_translation_array = array( 'mysticky_string' => $mysticky_options['mysticky_class_selector'] );
379
380
- wp_localize_script( 'mystickymenu', 'mysticky_name', $mysticky_translation_array );
381
- }
382
383
- add_action( 'wp_enqueue_scripts', 'mystickymenu_script' );
384
?>
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.6
7
Author: m.r.d.a
8
License: GPLv2 or later
9
*/
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
135
'my-stickymenu-settings',
136
'setting_section_id'
137
);
138
+
139
add_settings_field(
140
+ 'mysticky_active_on_height',
141
+ 'Make visible when scroled',
142
+ array( $this, 'mysticky_active_on_height_callback' ),
143
'my-stickymenu-settings',
144
'setting_section_id'
145
);
146
+
147
add_settings_field(
148
'myfixed_fade',
149
'Fade or slide effect',
151
'my-stickymenu-settings',
152
'setting_section_id'
153
);
154
+
155
+ add_settings_field(
156
+ 'myfixed_cssstyle',
157
+ '.myfixed css class',
158
+ array( $this, 'myfixed_cssstyle_callback' ),
159
+ 'my-stickymenu-settings',
160
+ 'setting_section_id'
161
+
162
+ );
163
}
164
165
/**
180
$new_input['myfixed_bgcolor'] = sanitize_text_field( $input['myfixed_bgcolor'] );
181
182
if( isset( $input['myfixed_opacity'] ) )
183
+ $new_input['myfixed_opacity'] = absint( $input['myfixed_opacity'] );
184
185
if( isset( $input['myfixed_transition_time'] ) )
186
$new_input['myfixed_transition_time'] = sanitize_text_field( $input['myfixed_transition_time'] );
187
188
if( isset( $input['myfixed_disable_small_screen'] ) )
189
$new_input['myfixed_disable_small_screen'] = absint( $input['myfixed_disable_small_screen'] );
190
+
191
+ if( isset( $input['mysticky_active_on_height'] ) )
192
+ $new_input['mysticky_active_on_height'] = absint( $input['mysticky_active_on_height'] );
193
+
194
+ if( isset( $input['myfixed_fade'] ) )
195
+ $new_input['myfixed_fade'] = sanitize_text_field( $input['myfixed_fade'] );
196
197
if( isset( $input['myfixed_cssstyle'] ) )
198
//$new_input['myfixed_cssstyle'] = esc_textarea( $input['myfixed_cssstyle'] );
199
$new_input['myfixed_cssstyle'] = sanitize_text_field( $input['myfixed_cssstyle'] );
200
201
202
return $new_input;
208
public function mysticky_default_options() {
209
210
global $options;
211
212
213
$default = array(
214
215
'mysticky_class_selector' => '.navbar',
217
'myfixed_bgcolor' => '#F39A30',
218
'myfixed_opacity' => '95',
219
'myfixed_transition_time' => '0.3',
220
'myfixed_disable_small_screen' => '359',
221
+ 'mysticky_active_on_height' => '320',
222
+ 'myfixed_fade' => false,
223
+ 'myfixed_cssstyle' => '.myfixed { margin:0 auto!important; float:none!important; border:0px!important; background:none!important; max-width:100%!important; }'
224
+
225
);
226
+
227
+ if ( get_option('mysticky_option_name') == false ) {
228
+
229
+
230
231
update_option( 'mysticky_option_name', $default );
232
}
233
+
234
+ /*
235
+ foreach ( $options as $option => $default_value ) {
236
+ if ( ! get_option( $option ) ) {
237
+ add_option( $option, $default_value );
238
+ } else {
239
+ update_option( $option, $default_value );
240
+ }
241
+ }
242
+ */
243
+ }
244
+
245
/**
246
* Print the Section text
247
*/
257
public function mysticky_class_selector_callback()
258
{
259
printf(
260
+ '<p class="description"><input type="text" size="8" id="mysticky_class_selector" name="mysticky_option_name[mysticky_class_selector]" value="%s" /> menu or header div class or id.</p>',
261
isset( $this->options['mysticky_class_selector'] ) ? esc_attr( $this->options['mysticky_class_selector']) : ''
262
);
263
}
265
public function myfixed_zindex_callback()
266
{
267
printf(
268
+ '<p class="description"><input type="text" size="8" id="myfixed_zindex" name="mysticky_option_name[myfixed_zindex]" value="%s" /> sticky z-index.</p>',
269
isset( $this->options['myfixed_zindex'] ) ? esc_attr( $this->options['myfixed_zindex']) : ''
270
);
271
}
273
public function myfixed_bgcolor_callback()
274
{
275
printf(
276
+ '<p class="description"><input type="text" size="8" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" value="%s" /> full width background color.</p>' ,
277
isset( $this->options['myfixed_bgcolor'] ) ? esc_attr( $this->options['myfixed_bgcolor']) : ''
278
);
279
}
281
public function myfixed_opacity_callback()
282
{
283
printf(
284
+ '<p class="description"><input type="text" size="4" id="myfixed_opacity" name="mysticky_option_name[myfixed_opacity]" value="%s" /> numbers 1-100.</p>',
285
isset( $this->options['myfixed_opacity'] ) ? esc_attr( $this->options['myfixed_opacity']) : ''
286
);
287
}
289
public function myfixed_transition_time_callback()
290
{
291
printf(
292
+ '<p class="description"><input type="text" size="4" id="myfixed_transition_time" name="mysticky_option_name[myfixed_transition_time]" value="%s" /> in seconds.</p>',
293
isset( $this->options['myfixed_transition_time'] ) ? esc_attr( $this->options['myfixed_transition_time']) : ''
294
);
295
}
297
public function myfixed_disable_small_screen_callback()
298
{
299
printf(
300
+ '<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 width, 0 to disable.</p>',
301
isset( $this->options['myfixed_disable_small_screen'] ) ? esc_attr( $this->options['myfixed_disable_small_screen']) : ''
302
);
303
}
304
+
305
+ public function mysticky_active_on_height_callback()
306
+ {
307
+ printf(
308
+ '<p class="description">after <input type="text" size="4" id="mysticky_active_on_height" name="mysticky_option_name[mysticky_active_on_height]" value="%s" />px, </p>',
309
+ isset( $this->options['mysticky_active_on_height'] ) ? esc_attr( $this->options['mysticky_active_on_height']) : ''
310
+ );
311
+ }
312
+
313
+ public function myfixed_fade_callback()
314
+ {
315
+ printf(
316
+ '<p class="description"><input id="%1$s" name="mysticky_option_name[myfixed_fade]" type="checkbox" %2$s /> Checked is slide, unchecked is fade.</p>',
317
+ 'myfixed_fade',
318
+ checked( isset( $this->options['myfixed_fade'] ), true, false )
319
+ );
320
+
321
+ }
322
+
323
public function myfixed_cssstyle_callback()
324
325
{
326
printf(
327
'
328
+ <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 />
329
' ,
330
isset( $this->options['myfixed_cssstyle'] ) ? esc_attr( $this->options['myfixed_cssstyle']) : ''
331
);
332
+ echo '<p class="description">Default style: .myfixed { margin:0 auto!important; float:none!important; border:0px!important; background:none!important; max-width:100%!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>';
333
}
334
335
}
336
337
+ if( is_admin() )
338
$my_settings_page = new MyStickyMenuPage();
339
340
+ // end plugin admin settings
341
342
+ // Remove default option for more link that jumps at the midle of page and its covered by menu
343
344
+ function mysticky_remove_more_jump_link($link)
345
+ {
346
+
347
+ $offset = strpos($link, '#more-');
348
+
349
+ if ($offset) {
350
+ $end = strpos($link, '"',$offset);
351
+ }
352
+
353
+ if ($end) {
354
+ $link = substr_replace($link, '', $offset, $end-$offset);
355
+ }
356
+
357
+ return $link;
358
}
359
+
360
+ add_filter('the_content_more_link', 'mysticky_remove_more_jump_link');
361
362
+ // Create style from options
363
364
+ function mysticky_build_stylesheet_content() {
365
366
$mysticky_options = get_option( 'mysticky_option_name' );
367
370
if ( is_user_logged_in() ) {
371
echo '#wpadminbar { position: absolute !important; top: 0px !important;}';
372
}
373
if ( $mysticky_options['myfixed_cssstyle'] == "" ) {
374
+ echo '.myfixed { margin:0 auto!important; float:none!important; border:0px!important; background:none!important; max-width:100%!important; }';
375
}
376
echo
377
$mysticky_options ['myfixed_cssstyle'] ;
378
+
379
echo
380
'
381
#mysticky-nav { width:100%!important; position: static;';
382
+
383
+ if (isset($mysticky_options['myfixed_fade'])){
384
+
385
echo
386
'top: -100px;';
387
}
388
echo
389
'}';
390
+
391
+ if ($mysticky_options ['myfixed_opacity'] == 100 ){
392
+
393
+
394
echo
395
+ '.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; }
396
';
397
+ }
398
+ if ($mysticky_options ['myfixed_opacity'] < 100 ){
399
+
400
401
+ echo
402
+ '.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; }
403
+ ';
404
+ }
405
406
if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
407
echo
408
+ '@media (max-width: ' . $mysticky_options ['myfixed_disable_small_screen'] . 'px) {.wrapfixed {position: static!important; display: none!important;}}
409
';
410
}
411
echo
412
'</style>
413
';
414
+ }
415
+
416
+ add_action('wp_head', 'mysticky_build_stylesheet_content');
417
418
419
+ function mystickymenu_script() {
420
421
$mysticky_options = get_option( 'mysticky_option_name' );
422
423
+ // Register scripts
424
+ wp_register_script('mystickymenu', WP_PLUGIN_URL. '/mystickymenu/mystickymenu.js', false,'1.0.0', true);
425
+ wp_enqueue_script( 'mystickymenu' );
426
427
+ // Localize mystickymenu.js script with myStickymenu options
428
+ $mysticky_translation_array = array(
429
+ 'mysticky_string' => $mysticky_options['mysticky_class_selector'] ,
430
+ 'mysticky_active_on_height_string' => $mysticky_options['mysticky_active_on_height'],
431
+ 'mysticky_disable_at_width_string' => $mysticky_options['myfixed_disable_small_screen']
432
+ );
433
434
+ wp_localize_script( 'mystickymenu', 'mysticky_name', $mysticky_translation_array );
435
+ }
436
437
+ add_action( 'wp_enqueue_scripts', 'mystickymenu_script' );
438
?>
readme.txt CHANGED
@@ -1,27 +1,97 @@
1
=== myStickymenu ===
2
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.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.
11
12
== Description ==
13
- Plugin is designed for Twentythirteen template but should work on any theme, it's using default twentythirteen ".navbar" css class and that should be modified for other themes if different.
14
15
Plugin Home + Demo URL: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
16
17
== Installation ==
18
19
- Install like any other plugin. After install activate.
20
21
- If using template other than Twenty Thirteen go to Settings / myStickymenu and change navigation class to .your_navbar_class or #your_navbar_id..
22
23
- Original javascript used from http://jsbin.com/omanut/2/edit
24
25
== Screenshots ==
26
1. screenshot-1.png shows administration settings.
27
- 2. screenshot-2.png shows menu when page is scrolled towards the bottom.
1
=== myStickymenu ===
2
Contributors: damiroquai
3
Donate link: http://wordpress.transformnews.com
4
+ Tags: sticky menu, twentythirteen, twenty-thirteen, plugin, menu, jquery
5
+ Requires at least: 3.5.1
6
Tested up to: 3.9.1
7
+ Stable tag: 1.6
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
+ 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. Do not forget this, it is a mandatory field.
14
+
15
+ Plugin is 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: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
20
21
== Installation ==
22
+ Install like any other plugin. After install activate. If using template other than Twenty Thirteen go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id..
23
+
24
25
+ == Frequently Asked Questions ==
26
27
+ = How to find Sticky Class, what should I enter here? =
28
+ So this depends on what you want to make sticky and what theme do you use, but for example if you want your menu to be sticky, than you can examine the code (in firefox right click and “View page source”) and find div in which your menu is situated. This div have some class or id, and that’s the Sticky Class we need. If using class than don’t forget to ad dot (.) in front of class name, or hash (#) in front of id name in Sticky Class field. Twenty Thirteen default working class is “.navbar” without of quotes.
29
30
31
== Screenshots ==
32
+
33
1. screenshot-1.png shows administration settings.
34
+ 2. screenshot-2.png shows menu when page is scrolled towards the bottom.
35
+
36
+
37
+ == Changelog ==
38
+
39
+ = 1.6 =
40
+ * Added: “Make visible when scroled” after number of pixels option.
41
+ * Fixed opacity 100 bug.
42
+
43
+ = 1.5 =
44
+ * Added option to enter exact width in px when sticky menu should be disabled “Disable at Small Screen Sizes”.
45
+ * Added “.myfixed css class” setting field – edit .myfixed css style via plugin settings to create custom style.
46
+ * Fixed google adsense clash and undefined index notice.
47
+ * is_user_logged_in instead of old “Remove CSS Rules for Static Admin Bar while Sticky” option
48
+
49
+ = 1.4 =
50
+ * Added fade in or slide down effect settings field for sticky class.
51
+ * Added new wrapped div around selected sticky class with id mysticky_wrap which should make menu works smoother and extend theme support.
52
+
53
+ = 1.3 =
54
+ * Added “block direct access” to the mystickymenu plugin file (for security sake).
55
+ * Added Enable / Disable at small screen sizes and Remove not necessary css for all themes without admin bar on front page.
56
+ * Added “margin-top :0px” to .myfixed class in head which should extend theme support.
57
+
58
+ = 1.2 =
59
+ * Fixed mystickymenu.js for IE browsers, so myStickymenu is now compatible with IE 10, 11
60
+
61
+ = 1.1 =
62
+ * Added administration options, now available through Dashboard / Settings / myStickymenu. Options are as follows: Sticky Class, Sticky z-index, Sticky Width, Sticky Background Color, Sticky Opacity, Sticky Transition Time.
63
+ * Old mystickymenu.css file is deprecated and not in use anymore.
64
+
65
+ = 1.0 =
66
+ * First release of myStickymenu plugin
67
+
68
+ == Upgrade Notice ==
69
+ = 1.6 =
70
+ * After plugin update go to mystickymenu plugin settings and save changes with desired value for a new parameters. Clear cache if some cache system used on your site.
71
+ * Added: “Make visible when scroled” after number of pixels option.
72
+ * Fixed opacity 100 bug.
73
+
74
+ = 1.5 =
75
+ * Added option to enter exact width in px when sticky menu should be disabled “Disable at Small Screen Sizes”.
76
+ * Added “.myfixed css class” setting field – edit .myfixed css style via plugin settings to create custom style.
77
+ * Fixed google adsense clash and undefined index notice.
78
+ * is_user_logged_in instead of old “Remove CSS Rules for Static Admin Bar while Sticky” option
79
+
80
+ = 1.4 =
81
+ * Added fade in or slide down effect settings field for sticky class.
82
+ * Added new wrapped div around selected sticky class with id mysticky_wrap.
83
+
84
+ = 1.3 =
85
+ * Added “block direct access” to the mystickymenu plugin file.
86
+ * Added Enable / Disable at small screen sizes and Remove not necessary css.
87
+ * Added “margin-top :0px” to .myfixed class in head which should extend theme support.
88
+
89
+ = 1.2 =
90
+ * Fixed mystickymenu.js for IE browsers, so myStickymenu is now compatible with IE 10, 11
91
+
92
+ = 1.1 =
93
+ * Added administration options, now available through Dashboard / Settings / myStickymenu. Options are as follows: Sticky Class, Sticky z-index, Sticky Width, Sticky Background Color, Sticky Opacity, Sticky Transition Time.
94
+ * Old mystickymenu.css file is deprecated and not in use anymore.
95
+
96
+
97
+
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file