[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
This commit is contained in:
mistic100
2013-12-22 16:31:56 +00:00
parent 9204acfde2
commit a38bd0de69
2 changed files with 20 additions and 18 deletions

View File

@@ -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
});
}
});

View File

@@ -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;}