From 77ec43f9f059f2fbb141cf6e4313dd6153808a6e Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 22 Dec 2013 16:31:56 +0000 Subject: [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 --- themes/elegant/scripts_pp.js | 35 +++++++++++++++++++---------------- themes/elegant/theme.css | 3 +-- 2 files changed, 20 insertions(+), 18 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 + }); } }); diff --git a/themes/elegant/theme.css b/themes/elegant/theme.css index 0c247e0a7..83f130deb 100644 --- a/themes/elegant/theme.css +++ b/themes/elegant/theme.css @@ -237,7 +237,7 @@ a:hover { border-bottom: none;} /* image comments */ -#thePicturePage #comments { padding: 2px 5px;} +#thePicturePage #comments { padding: 2px 5px; position:relative;} #thePicturePage #comments h3 { margin: 10px 0;} #thePicturePage #comments form { margin: 10px 0;} #thePicturePage #comments fieldset { margin: 0 1em;} @@ -255,7 +255,6 @@ 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;} -- cgit v1.2.3