Permalink
Browse files

added the constraint option

  • Loading branch information...
1 parent 2993f41 commit 50ef051fb89e2c00b34664d2e01915165d07010e @p-m-p committed May 7, 2011
Showing with 6 additions and 3 deletions.
  1. +1 −0 README.md
  2. +4 −2 js/stickysidebar.jquery.js
  3. +1 −1 style/sticky.css
View
@@ -19,6 +19,7 @@ Options
* speed (default = 150) - the duration of the animation
* easing (default = 'linear') - the easing to use for the animation
* padding (default = 10) - amount of padding from top of window
+* constrain (default = false) - set true to stop from scrolling out of parent
Methods
---
@@ -4,6 +4,7 @@
speed: 350 //animation duration
, easing: "linear" //use easing plugin for more options
, padding: 10
+ , constrain: false
}
, $window = $(window)
, stickyboxes = []
@@ -101,8 +102,9 @@
var padBtm = parseInt($parent.css("paddingBottom"));
padBtm = isNaN(padBtm) ? 0 : padBtm;
data.offs = parentOffs;
- data.offs.bottom =
- Math.abs(($parent.innerHeight() - padBtm) - $this.outerHeight());
+ data.offs.bottom = settings.constrain ?
+ Math.abs(($parent.innerHeight() - padBtm) - $this.outerHeight()) :
+ $(document).height();
}
else data.offs = { // went to far set to doc
top: 0
View
@@ -1,5 +1,5 @@
#wrap { width: 800px; margin: 0 auto; }
-#main { width: 500px; margin: 0 25px 0 0; float: left; }
+#main { width: 500px; height: 1500px; margin: 0 25px 0 0; float: left; }
#side {
width: 275px;
float: left;

0 comments on commit 50ef051

Please sign in to comment.