开发者

How to fade in with jQuery

开发者 https://www.devze.com 2023-02-09 21:44 出处:网络
My idea is to fade in to the tab that is loaded. This code seems like it should work, but it doesn\'t fade in. What is wrong?

My idea is to fade in to the tab that is loaded.

This code seems like it should work, but it doesn't fade in. What is wrong?

$(document).ready(function() {
    $("#logo").click(function(event) {
        $("#central").fadeIn("slow").load('page.html');
    });
});开发者_如何学C


You have to hide #central first, before fading it in:

$('#central').hide().fadeIn('slow').load('page.html');


Jacob's answer is right, of course, but I'd hazard a guess that you probably want to load the html and then fade it in?

$(document).ready(function() {
    $("#logo").click(function(event) {
        $("#central").load('page.html', function() {
           $(this).fadeIn("slow");
        });
    });
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号