SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [solved] jQuery's animate doesn't work when scrollTop > 0

    Hi, I hope that someone here will be able to help me..

    I have a link, but I can't post it.

    Normally, it looks great, but if you resize your window and scroll down (make document.scrollTop > 0) and then reload the page, the messagebox doesn't appear.

    It seems to be a problem with animate function of jQuery.

    This line is opening the box:

    Code:
    	$(".phui_message").css({opacity:0, marginTop: "50px"}).show().animate({opacity:1, marginTop: 0});
    phui.message.js, line 28

    It all works when scrollTop = 0. If it's more than 0, then the message doesn't appear. It is created, the css function is executed (in firebug there's div with opacity=0, and marginTop=50px.. but the animate function doesn't animate it to opacity 1 and marginTop 0...

    This happens only if the message is supposed to appear after loading the page (document.ready).. If it is loaded after clicking a button, then it works..

    Thank you for your help
    Last edited by zero0x; Sep 20, 2008 at 06:31.

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ha I solved it out

    I don't even know how is this possible, but I have add a line of code, which moves the message to the center (i call this fun on scroll) and it works now


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •