Q2W3 Fixed Widget - Version 1.0.1

Version Description

  • Improved compatibility with Webkit based browsers (like Chrome and Safari).
  • Removed unnecessary CSS.
Download this release

Release Info

Developer Max Bond
Plugin Icon 128x128 Q2W3 Fixed Widget
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0 to 1.0.1

css/style.css DELETED
@@ -1,6 +0,0 @@
1
- @CHARSET "UTF-8";
2
-
3
- .q2w3-fixed-widget {
4
- position: fixed;
5
- top: 10px;
6
- }
 
 
 
 
 
 
js/{function.js → functions.js} RENAMED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function () {
2
  var i = 0;
3
  var vertical_offset = 10;
4
  while ( q2w3_fixed_widgets[i] ) {
@@ -12,23 +12,20 @@ function q2w3_fixed_widget(widget_id, vertical_offset) {
12
  var widget_width = jQuery('#' + widget_id).css('width');
13
  var widget_margin = jQuery('#' + widget_id).css('margin');
14
  var widget_padding = jQuery('#' + widget_id).css('padding');
15
- var top = jQuery('#' + widget_id).offset().top - parseFloat(jQuery('#' + widget_id).css('marginTop').replace(/auto/, 0));
16
  top -= vertical_offset;
 
17
  jQuery(window).scroll(function (event) {
18
- // what the y position of the scroll is
19
- var y = jQuery(this).scrollTop();
20
-
21
- // whether that's below the form
22
- if (y >= top) {
23
- // if so, ad the fixed class
24
- jQuery('#' + widget_id).addClass('q2w3-fixed-widget');
25
  jQuery('#' + widget_id).css('width', widget_width);
26
  jQuery('#' + widget_id).css('margin', widget_margin);
27
  jQuery('#' + widget_id).css('padding', widget_padding);
28
  jQuery('#' + widget_id).css('top', vertical_offset);
29
  } else {
30
- // otherwise remove it
31
- jQuery('#' + widget_id).removeClass('q2w3-fixed-widget');
32
  }
33
  });
34
  }
1
+ jQuery(window).load(function () {
2
  var i = 0;
3
  var vertical_offset = 10;
4
  while ( q2w3_fixed_widgets[i] ) {
12
  var widget_width = jQuery('#' + widget_id).css('width');
13
  var widget_margin = jQuery('#' + widget_id).css('margin');
14
  var widget_padding = jQuery('#' + widget_id).css('padding');
15
+ var top = jQuery('#' + widget_id).offset().top;
16
  top -= vertical_offset;
17
+
18
  jQuery(window).scroll(function (event) {
19
+ if ( jQuery(this).scrollTop() >= top ) {
20
+ // fixed
21
+ jQuery('#' + widget_id).css('position', 'fixed');
 
 
 
 
22
  jQuery('#' + widget_id).css('width', widget_width);
23
  jQuery('#' + widget_id).css('margin', widget_margin);
24
  jQuery('#' + widget_id).css('padding', widget_padding);
25
  jQuery('#' + widget_id).css('top', vertical_offset);
26
  } else {
27
+ // normal
28
+ jQuery('#' + widget_id).css('position', 'static');
29
  }
30
  });
31
  }
q2w3-fixed-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Q2W3 Fixed Widget
4
  Plugin URI: http://www.q2w3.ru/q2w3-fixed-widget-wordpress-plugin/
5
  Description: Fixes positioning of the selected widgets, when the page is scrolled down.
6
  Author: Max Bond
7
- Version: 1.0
8
  Author URI: http://www.q2w3.ru/
9
  */
10
 
@@ -42,13 +42,9 @@ class q2w3_fixed_widget {
42
 
43
  public static function init() {
44
 
45
- $plugin_url = plugin_dir_url( __FILE__ );
46
-
47
- wp_enqueue_style('q2w3-fixed-widget', $plugin_url . 'css/style.css', false, '1.0', 'all');
48
-
49
  wp_enqueue_script('jquery');
50
 
51
- wp_enqueue_script('q2w3-fixed-widget', $plugin_url . 'js/function.js', array('jquery'), '1.0', true);
52
 
53
  }
54
 
4
  Plugin URI: http://www.q2w3.ru/q2w3-fixed-widget-wordpress-plugin/
5
  Description: Fixes positioning of the selected widgets, when the page is scrolled down.
6
  Author: Max Bond
7
+ Version: 1.0.1
8
  Author URI: http://www.q2w3.ru/
9
  */
10
 
42
 
43
  public static function init() {
44
 
 
 
 
 
45
  wp_enqueue_script('jquery');
46
 
47
+ wp_enqueue_script('q2w3-fixed-widget', plugin_dir_url( __FILE__ ) . 'js/functions.js', array('jquery'), '1.1', true);
48
 
49
  }
50
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.q2w3.ru/q2w3-fixed-widget-wordpress-plugin/#donate
4
  Tags: q2w3, widget, fixed, scroll, fixed scroll, floating, floating widget, fixed widget, sticky, sticky widget, sidebar
5
  Requires at least: 3.0
6
  Tested up to: 3.4.2
7
- Stable tag: 1.0
8
 
9
  Fixes positioning of the selected widgets, when the page is scrolled down.
10
 
@@ -48,5 +48,10 @@ There are several reasons:
48
 
49
  == Changelog ==
50
 
 
 
 
 
 
51
  = 1.0 =
52
  * First public release.
4
  Tags: q2w3, widget, fixed, scroll, fixed scroll, floating, floating widget, fixed widget, sticky, sticky widget, sidebar
5
  Requires at least: 3.0
6
  Tested up to: 3.4.2
7
+ Stable tag: 1.0.1
8
 
9
  Fixes positioning of the selected widgets, when the page is scrolled down.
10
 
48
 
49
  == Changelog ==
50
 
51
+ = 1.0.1 =
52
+ * Improved compatibility with Webkit based browsers (like Chrome and Safari).
53
+ * Removed unnecessary CSS.
54
+
55
+
56
  = 1.0 =
57
  * First public release.