aboutsummaryrefslogtreecommitdiffstats
path: root/themes/elegant/scripts_pp.js
diff options
context:
space:
mode:
authorflop25 <flop25@piwigo.org>2013-06-16 18:20:19 +0000
committerflop25 <flop25@piwigo.org>2013-06-16 18:20:19 +0000
commit272a55d377f104a03f3fd0d2cc3c0e8c6497e57b (patch)
treec3067d44177fe2bfc619f85a4e0a17ed58172ea4 /themes/elegant/scripts_pp.js
parent2b8ea75b1d7adfbabe0f0a7303f7d0b272da3cd3 (diff)
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
Diffstat (limited to 'themes/elegant/scripts_pp.js')
-rw-r--r--themes/elegant/scripts_pp.js47
1 files 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");;