Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Function not being updated correctly

  • This topic is empty.
Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #236196
    xvilo
    Participant

    @Alen just replaced your code with mine, but still the left sidebar is not showing up… Is this a local problem?

    http://cp.thisisd3.com/

    #236198
    Shikkediel
    Participant

    You’re executing the function on something that’s removed with the Ajax call whenever a link is clicked – including the inline style that makes it visible. Instead you’d better apply it to the new content after it’s loaded.

    #236200
    xvilo
    Participant

    I’m very very new to JS, so could you please help me out?

    #236201
    Alen
    Participant

    You need to call calcLeftWrapper(); when the page is done fading in.

    In your code, try:

    /* code emmited for brevity */
    $mainContent.fadeIn(200, function() {
      $pageWrap.animate({
        height: baseHeight + $mainContent.height() + "px"
      });
     calcLeftWrapper(); /* fn call */
    });
    
    #236204
    xvilo
    Participant

    Thanks helped!

    #236390
    Shikkediel
    Participant

    Just a side note, realising all this isn’t needed either :

    $(function() {calcLeftWrapper()});
    

    Because even this’ll do :

    $(calcLeftWrapper);
    
Viewing 6 posts - 16 through 21 (of 21 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.