From 272a55d377f104a03f3fd0d2cc3c0e8c6497e57b Mon Sep 17 00:00:00 2001 From: flop25 Date: Sun, 16 Jun 2013 18:20:19 +0000 Subject: [PATCH] bug:2923 fix the bug if the panel was closed then opened git-svn-id: http://piwigo.org/svn/trunk@23269 68402e56-0260-453c-a942-63ccdbb3a9ee --- themes/elegant/scripts_pp.js | 47 ++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/themes/elegant/scripts_pp.js b/themes/elegant/scripts_pp.js index bf7e1531d..b9a9352a6 100644 --- a/themes/elegant/scripts_pp.js +++ b/themes/elegant/scripts_pp.js @@ -167,23 +167,25 @@ 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'); + } + }); + } } - 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'); - } - }); }); @@ -196,6 +198,21 @@ function commentsToggle() { 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 + 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'); + } + }); + } else { comments.addClass("commentshidden").removeClass("commentsshown"); comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off");;