diff options
-rw-r--r-- | themes/elegant/scripts_pp.js | 17 | ||||
-rw-r--r-- | themes/elegant/theme.css | 2 |
2 files changed, 17 insertions, 2 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');
+ }
+ });
+
});
diff --git a/themes/elegant/theme.css b/themes/elegant/theme.css index 95f7c7a92..cd2be7e89 100644 --- a/themes/elegant/theme.css +++ b/themes/elegant/theme.css @@ -256,7 +256,7 @@ a:hover { border-bottom: none;} font-family: Arial,Helvetica,sans-serif; font-size: 100%; } - +#commentAdd.fixed { position: fixed; top: 10px; } #pictureCommentList .commentsOrder { float: left; margin-bottom: 5px;} #pictureCommentList .navigationBar { float: right; margin-bottom: 5px;} #pictureComments h4 { margin: 0;} |