Forum Moderators: open

Message Too Old, No Replies

Animation" snapping in" only on the first element.

jQuery fade() method

         

rocknbil

10:08 pm on Oct 30, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This may be some bug in FF. Doesn't do it, oddly enough, in any version of I.E.

I have a list:

<ul>
<li><a id="work" href="#">Our Work</a></li>
<li><a id="company" href="#">Our Company</a></li>
<li><a id="learn" href="#">Learn More</a></li>
<li><a id="contact" href="#">Contact Us</a></li>
</ul>

Click the link and it opens a panel below with other stuff, and a lightbox-ish overlay over the rest of the page. It animates in with fadeIn()/fadeOut(). It works perfectly with a single annoying exception.

With a cleared cache, the overlay layer animation "snaps in" only on the first list item. I clear the cache, hit the other three links and it's smooth. Just the first item.

I could post the full code but it's not likely useful, this particular aberration is manifested in this one line (3 here: )

$('#nav-overlay').fadeIn(500, function () {
$('#full-width-nav-underlay').fadeIn(500);
});

As you can see it chains two fade ins, the second one always operates smoothly, it's just the first one - and only on the first link in the list - that hiccups. Any only on a fresh load, subsequent clicks on that link are fine.

I get the same effect without the chain:

$('#nav-overlay').fadeIn(500);

Just on the first link in the list.

Document is validated 4.01 strict, jQuery is 1.2.6.min.js, anyone seen this before or have ideas as to it's cause?

enigma1

10:32 am on Nov 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There isn't enough info to replicate the problem. I tried it with the list you posted and the fadein but I do not see an issue.

You could check if the section with the list has an absolute positioning, because it could be the CSS that is causing it. One thing I remember with a lightbox it would not fire the first time if I specified a selector for the lightbox inside the click handler. And I had to call the plugin in that particular case without a selector.