Changeset 23269 for trunk/themes


Ignore:
Timestamp:
Jun 16, 2013, 8:20:19 PM (11 years ago)
Author:
flop25
Message:

bug:2923
fix the bug if the panel was closed then opened

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/themes/elegant/scripts_pp.js

    r23251 r23269  
    168168                comments_button.click(function() { commentsToggle() });
    169169                commentsswicther.click(function() { commentsToggle() });
    170        
     170
     171    if (jQuery('#commentAdd').is(":visible")) {
     172      var top = jQuery('#commentAdd').offset().top - parseFloat(jQuery('#commentAdd').css('marginTop').replace(/auto/, 0));
     173      jQuery(window).scroll(function (event) {
     174        // what the y position of the scroll is
     175        var y = jQuery(this).scrollTop();
     176     
     177        // whether that's below the form
     178        if (y >= top) {
     179          // if so, ad the fixed class
     180          jQuery('#commentAdd').addClass('fixed');
     181        } else {
     182          // otherwise remove it
     183          jQuery('#commentAdd').removeClass('fixed');
     184        }
     185      });
     186    }
    171187        }
    172188 
    173   var top = jQuery('#commentAdd').offset().top - parseFloat(jQuery('#commentAdd').css('marginTop').replace(/auto/, 0));
    174   jQuery(window).scroll(function (event) {
    175     // what the y position of the scroll is
    176     var y = jQuery(this).scrollTop();
    177  
    178     // whether that's below the form
    179     if (y >= top) {
    180       // if so, ad the fixed class
    181       jQuery('#commentAdd').addClass('fixed');
    182     } else {
    183       // otherwise remove it
    184       jQuery('#commentAdd').removeClass('fixed');
    185     }
    186   });
    187189
    188190       
     
    197199                        comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on");;
    198200                        jQuery.cookie('comments', 'visible', {path: "/"});
     201      var top = jQuery('#commentAdd').offset().top - parseFloat(jQuery('#commentAdd').css('marginTop').replace(/auto/, 0));
     202      jQuery(window).scroll(function (event) {
     203        // what the y position of the scroll is
     204        var y = jQuery(this).scrollTop();
     205     
     206        // whether that's below the form
     207        if (y >= top) {
     208          // if so, ad the fixed class
     209          jQuery('#commentAdd').addClass('fixed');
     210        } else {
     211          // otherwise remove it
     212          jQuery('#commentAdd').removeClass('fixed');
     213        }
     214      });
     215
    199216                } else {
    200217                        comments.addClass("commentshidden").removeClass("commentsshown");
Note: See TracChangeset for help on using the changeset viewer.