diff options
author | mistic100 <mistic@piwigo.org> | 2013-12-22 16:31:56 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2013-12-22 16:31:56 +0000 |
commit | 77ec43f9f059f2fbb141cf6e4313dd6153808a6e (patch) | |
tree | 6711eb906cf227dd53d4f557e14c7524537b0d60 /themes/elegant/scripts_pp.js | |
parent | fd4b73efa3a4594c45cf8b06a287ddad3416ff4c (diff) |
[elegant] fix comment form width change when scrolling caused by menubar size
git-svn-id: http://piwigo.org/svn/trunk@26086 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'themes/elegant/scripts_pp.js')
-rw-r--r-- | themes/elegant/scripts_pp.js | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/themes/elegant/scripts_pp.js b/themes/elegant/scripts_pp.js index 62253d621..be2bbfe26 100644 --- a/themes/elegant/scripts_pp.js +++ b/themes/elegant/scripts_pp.js @@ -53,17 +53,18 @@ function commentsToggle() { if (comments.hasClass("commentshidden")) { - comments.removeClass("commentshidden").addClass("commentsshown"); - comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on");; - session_storage['comments'] = 'visible'; + comments.removeClass("commentshidden").addClass("commentsshown"); + comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on");; + session_storage['comments'] = 'visible'; - comments_top_offset = comments_add.offset().top - parseFloat(comments_add.css('marginTop').replace(/auto/, 0)); - } - else { - comments.addClass("commentshidden").removeClass("commentsshown"); - comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off");; - session_storage['comments'] = 'hidden'; - } + comments_top_offset = comments_add.offset().top - parseFloat(comments_add.css('marginTop').replace(/auto/, 0)); + } + else { + comments.addClass("commentshidden").removeClass("commentsshown"); + comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off");; + session_storage['comments'] = 'hidden';
+ comments_top_offset = 0; + } } jQuery(function(){ @@ -143,17 +144,19 @@ jQuery(window).scroll(function (event) { if (comments_top_offset==0) return; - // what the y position of the scroll is var y = jQuery(this).scrollTop(); - // whether that's below the form if (y >= comments_top_offset) { - // if so, ad the fixed class - comments_add.addClass('fixed'); + comments_add.css({
+ 'position': 'absolute',
+ 'top': y-comments.offset().top+10
+ }); } else { - // otherwise remove it - comments_add.removeClass('fixed'); + comments_add.css({
+ 'position': 'static',
+ 'top': 0
+ }); } }); |