double click on first load, why ?

double click on first load, why ?

finally I get my Up and Down effect solved with these lines, but I noticed that I have to click the clickable the area twice on the first load, would anyone here tell me why ?

here's the code

  1. $(document).ready(function() {
  2.     $("#slideHeader").click( function() {
  3.        if ($("#openCloseIdentifier").is(":hidden")) {
  4.      $(".boxgrid").animate({ 
  5.        marginBottom: "-100px"
  6.      }, {duration: 'slow', easing: 'easeInOutCubic'} );
  7.      $('#myToggle').css('background-position', '0 0');
  8.      $("#openCloseIdentifier").show();
  9.      } else {
  10.     $(".boxgrid").animate({ 
  11.       marginBottom: "0px"
  12.      }, {duration: 'slow', easing: 'easeInOutCubic'} );
  13.    $('#myToggle').css('background-position', '0 -20px');
  14.    $("#openCloseIdentifier").hide();
  15.   }
  16. });  
  17. });
thanks
    • Topic Participants

    • aikju