重置已更改的css值

Aeo*_*ius 23 css jquery

我有...

$("#menu_tl").click(function() {

    $('.page').fadeOut();
    $('.page').animate({
        "width":  "0px", 
        "height": "0px", 
        "top":    "50px", 
        "left":   "50px"
    });

    $('#page1').fadeIn();
    $('#page1').animate({
        "width":  "500px", 
        "height": "400px", 
        "top":    "-350px", 
        "left":   "-450px"
    }, 2000);
});

$("#menu_tr").click(function() {

    $('.page').fadeOut();
    $('.page').animate({
        "width":  "0px", 
        "height": "0px", 
        "top":    "50px", 
        "left":   "50px"
    });

    $('#page2').fadeIn();
    $('#page2').animate({
        "width":  "500px", 
        "height": "400px"
    }, 2000);
});
Run Code Online (Sandbox Code Playgroud)

但是我想说,当点击第二个函数时,应该重置所有被第一个改变的css.这意味着以下行是错误的:

$('.page').animate({
    "width":  "0px", 
    "height": "0px", 
    "top":    "50px", 
    "left":   "50px"
});
Run Code Online (Sandbox Code Playgroud)

是错误的,应该用全局重置代替.希望这很清楚......

c-s*_*ile 54

这个

$('.page').css({"width":"", "height":"", "top": "", "left" : ""});
Run Code Online (Sandbox Code Playgroud)

应该为你做魔术.