fix the bug if the panel was closed then opened

git-svn-id: http://piwigo.org/svn/trunk@23269 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
flop25 2013-06-16 18:20:19 +00:00
parent 2b8ea75b1d
commit 272a55d377

View file

@ -168,8 +168,36 @@ 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');
}
});
}
}
});
function commentsToggle() {
var comments=jQuery("#thePicturePage #comments");
var comments_button=jQuery("#comments h3");
if (comments.hasClass("commentshidden")) {
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
@ -185,17 +213,6 @@ jQuery("document").ready(function(jQuery){
}
});
});
function commentsToggle() {
var comments=jQuery("#thePicturePage #comments");
var comments_button=jQuery("#comments h3");
if (comments.hasClass("commentshidden")) {
comments.removeClass("commentshidden").addClass("commentsshown");
comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on");;
jQuery.cookie('comments', 'visible', {path: "/"});
} else {
comments.addClass("commentshidden").removeClass("commentsshown");
comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off");;