0

嘿,我正在尝试重写此代码,但它只能部分工作,假设代码在移动内容 div 的同时移动框。内容 div .c_right 只移动,但 .icon-menu-2 不移动。如何修复此代码?这是代码:

var timer;

$(".icon-menu-2").animate({marginRight: "30px", queue: false, duration: "slow", display: "toggle"});
$(".c_right").animate({marginRight: "215px", queue: false, duration: "slow", display: "toggle"}
, function () {
    timer = setTimeout(function () {
$(".icon-menu-2").animate({marginRight: "-155px", queue: false, duration: "slow", display: "toggle"});      
$(".c_right").animate({marginRight: "215px", display: "toggle"}, {queue: false, duration: "slow"})
    }, 500);
});

http://jsfiddle.net/5b5zH/3/

如何修复我的代码?

4

1 回答 1

0
var timer;

$(".icon-menu-2").animate({marginRight: "30px", queue: false, duration: "slow", display: "toggle"});
$(".c_right").animate({marginRight: "215px", queue: false, duration: "slow", display: "toggle"}
, function () {
    timer = setTimeout(function () {
    $(".c_right").animate({marginRight: "215px", display: "toggle", 'padding-right':$(".c_left").width()}, {queue: false, duration: "slow"}, 500);

$(".icon-menu-2").animate({marginRight: "-155px", queue: false, duration: "slow", display: "toggle"});   
        $(".c_left").animate({marginRight: "215px", display: "toggle"}, {queue: false, duration: "slow"})
    }, 500); 

});

这对你有用吗?不确定你想要什么

http://jsfiddle.net/7mFGx/

于 2013-10-12T23:23:35.407 回答