aboutsummaryrefslogtreecommitdiffstats
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--themes/elegant/scripts_pp.js47
1 files changed, 32 insertions, 15 deletions
diff --git a/themes/elegant/scripts_pp.js b/themes/elegant/scripts_pp.js
index bf7e1531d..b9a9352a6 100644
--- a/themes/elegant/scripts_pp.js
+++ b/themes/elegant/scripts_pp.js
@@ -167,23 +167,25 @@ jQuery("document").ready(function(jQuery){
comments_button.click(function() { commentsToggle() });
commentsswicther.click(function() { commentsToggle() });
-
+
+ if (jQuery('#commentAdd').is(":visible")) {
+ 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');
+ }
+ });
+ }
}
- 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');
- }
- });
});
@@ -196,6 +198,21 @@ function commentsToggle() {
comments.removeClass("commentshidden").addClass("commentsshown");
comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on");;
jQuery.cookie('comments', 'visible', {path: "/"});
+ 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');
+ }
+ });
+
} else {
comments.addClass("commentshidden").removeClass("commentsshown");
comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off");;