Skip to content

Commit

Permalink
Merge pull request #6 from MikeGrace/gh-pages
Browse files Browse the repository at this point in the history
CSS Class based on pin state
  • Loading branch information
biilmann committed May 8, 2013
2 parents 7a2a297 + 89aa497 commit a29aced
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jquery.pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
if (options.minWidth && $window.width() <= options.minWidth) {
if ($this.parent().is(".pin-wrapper")) { $this.unwrap(); }
$this.css({width: "", left: "", top: "", position: ""});
if (options.activeClass) { $this.removeClass(options.activeClass); }
disabled = true;
continue;
} else {
Expand Down Expand Up @@ -60,13 +61,16 @@
left: $this.offset().left,
top: 0
}).css("position", "fixed");
if (options.activeClass) { $this.addClass(options.activeClass); }
} else if (scrollY >= to) {
$this.css({
left: "auto",
top: to - data.parentTop
}).css("position", "absolute");
if (options.activeClass) { $this.addClass(options.activeClass); }
} else {
$this.css({position: "", top: "", left: ""});
if (options.activeClass) { $this.removeClass(options.activeClass); }
}
}
};
Expand Down

0 comments on commit a29aced

Please sign in to comment.