Re: [jQuery] Easy Fade in Problem...
Try putting the fadeIn() where the elements are being appended. Also,
use hide() just before that.
function addPerson() {
//current keeps track of how many people we have.
var strToAdd = '<div id="input" class="ideaInput"><input
name="idea[]" class="idea" type="text"/><textarea name="description[]"
class="description"></textarea></div>';
$('#all-inputs').append(strToAdd).hide().fadeIn('slow');
};
$(document).ready(function() {
$('#btnAdd').click(function () {
addPerson();
});
});
And, if you don't need to call addPerson() from anywhere else, you
could tighten this up even more:
$(document).ready(function()
{
$('#btnAdd').click(function ()
{
var strToAdd = '<div id="input" class="ideaInput"><input
name="idea[]" class="idea" type="text"/><textarea name="description[]"
class="description"></textarea></div>';
$('#all-inputs').append(strToAdd).hide().fadeIn('slow');
});
});
On Sat, Dec 19, 2009 at 10:27 PM, Alex B <alexbadalyan@gmail.com> wrote:
> Anyone know why it's not fading in the content? It's fully functional,
> but it just doesn't "fadeIn"..
>
> function addPerson() {
>
> //current keeps track of how many people we have.
> var strToAdd = '<div id="input" class="ideaInput"><input
> name="idea[]" class="idea" type="text"/>'
> strToAdd += '<textarea name="description[]" class="description"></
> textarea></div>'
>
> $('#all-inputs').append(strToAdd);
> };
>
>
> $(document).ready(function() {
> $('#btnAdd').click(function () {
> $(addPerson).fadeIn('slow')
> });
> });
>
>
>
> I apologize if this isn't the correct place to post this type of
> issue. It seems like this would be a great resource.
>
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home