diff options
author | flop25 <flop25@piwigo.org> | 2013-06-15 16:49:38 +0000 |
---|---|---|
committer | flop25 <flop25@piwigo.org> | 2013-06-15 16:49:38 +0000 |
commit | cbce862520410e2e3c47082553359f66cd6cb2c3 (patch) | |
tree | 505162442ccf777f342a1153d0c84b54f05c66a3 /themes/elegant/scripts_pp.js | |
parent | 6fafebd52a0f7075a7d682f23755bb9ba35cd1e7 (diff) |
bug:2923
adding js to fix the "Add acomment" div when scrolling
git-svn-id: http://piwigo.org/svn/trunk@23233 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'themes/elegant/scripts_pp.js')
-rw-r--r-- | themes/elegant/scripts_pp.js | 17 |
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');
+ }
+ });
+
});
|