Why doesn't jquery fadeIn() work with .html()?

╄→гoц情女王★ 提交于 2019-11-27 06:31:36

No fadeIn is done because the #message element is visible, hide it, add the content and fade it in:

$('#message').hide().html("You clicked on a checkbox.").fadeIn('slow');

after analize this problem, that I have to solve, this is my code, that works to use fadeout, change html and fadein

$("#div_big_picture").fadeOut('slow',function(){
    $(this).html("<img src='" + str_to_load + "' height='800px' />")
}).fadeIn("slow");

No idea why but I've had trouble chaining this before. You can get the effect you want by using this less elegant code:

google.load("jquery", "1.3.2");

//run when page is loaded
google.setOnLoadCallback(function() {

    $('.checkboxList .row').css('color','red');
    $('.checkboxList input').attr('checked', true);
    $('.checkboxList input').bind('click', function() {
        $('#message').hide(); //just in case
        $('#message').html("You clicked on a checkbox.");
        $('#message').fadeIn('slow');
    });

});
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!