Skip to content

Commit a29aced

Browse files
committed
Merge pull request webpop#6 from MikeGrace/gh-pages
CSS Class based on pin state
2 parents 7a2a297 + 89aa497 commit a29aced

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

jquery.pin.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
if (options.minWidth && $window.width() <= options.minWidth) {
1313
if ($this.parent().is(".pin-wrapper")) { $this.unwrap(); }
1414
$this.css({width: "", left: "", top: "", position: ""});
15+
if (options.activeClass) { $this.removeClass(options.activeClass); }
1516
disabled = true;
1617
continue;
1718
} else {
@@ -60,13 +61,16 @@
6061
left: $this.offset().left,
6162
top: 0
6263
}).css("position", "fixed");
64+
if (options.activeClass) { $this.addClass(options.activeClass); }
6365
} else if (scrollY >= to) {
6466
$this.css({
6567
left: "auto",
6668
top: to - data.parentTop
6769
}).css("position", "absolute");
70+
if (options.activeClass) { $this.addClass(options.activeClass); }
6871
} else {
6972
$this.css({position: "", top: "", left: ""});
73+
if (options.activeClass) { $this.removeClass(options.activeClass); }
7074
}
7175
}
7276
};

0 commit comments

Comments
 (0)