1

I have a click function which grabs the contents of one div and loads it into another. I'd like to add a simple fade to that loading. Here's what I have so far:

$("ul.portfolio li a").click(function(e) { e.preventDefault(); var content = $(this).next('.clickContent').html(); $("#container").html(content).fadeIn('slow'); }); 

It's not working. The content just loads. Any idea how to get this to animate??

Thanks in advance!

1 Answer 1

5

You need to hide the div first:

$("ul.portfolio li a").click(function(e) { e.preventDefault(); var content = $(this).next('.clickContent').html(); $("#container").hide().html(content).fadeIn('slow'); // added .hide() }); 
Sign up to request clarification or add additional context in comments.

1 Comment

I love it when it's something simple! Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.