aboutsummaryrefslogtreecommitdiffstats
path: root/themes/elegant/scripts_pp.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--themes/elegant/scripts_pp.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/themes/elegant/scripts_pp.js b/themes/elegant/scripts_pp.js
index 92e8cfc06..79d700ebb 100644
--- a/themes/elegant/scripts_pp.js
+++ b/themes/elegant/scripts_pp.js
@@ -155,7 +155,22 @@ jQuery("document").ready(function(jQuery){
commentsswicther.click(function() { commentsToggle() });
}
-
+
+ var top = jQuery('#commentAdd').offset().top - parseFloat(jQuery('#commentAdd').css('marginTop').replace(/auto/, 0));
+ jQuery(window).scroll(function (event) {
+ // what the y position of the scroll is
+ var y = jQuery(this).scrollTop();
+
+ // whether that's below the form
+ if (y >= top) {
+ // if so, ad the fixed class
+ jQuery('#commentAdd').addClass('fixed');
+ } else {
+ // otherwise remove it
+ jQuery('#commentAdd').removeClass('fixed');
+ }
+ });
+
});