Skip to content

Commit

Permalink
bug:2923
Browse files Browse the repository at this point in the history
fix the bug if the panel was closed then opened

git-svn-id: http://piwigo.org/svn/trunk@23269 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
flop25 committed Jun 16, 2013
1 parent 2b8ea75 commit 272a55d
Showing 1 changed file with 32 additions and 15 deletions.
47 changes: 32 additions & 15 deletions themes/elegant/scripts_pp.js
Expand Up @@ -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');
}
});


});
Expand All @@ -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");;
Expand Down

0 comments on commit 272a55d

Please sign in to comment.