在jQuery中设置从右到左问题的动画

在jQuery中设置从右到左问题的动画,jquery,animation,Jquery,Animation,正如你在这里看到的:,它是朝着左-右的方向工作的。我想做完全相反的事情;从右到左。 我该怎么做?thx $(".inno-bg").mouseenter(function(){ $(this).find("h2").stop(true, true).animate({ 'marginTop': "-=60px" }, 200); $(this).css('background-image', 'none'); $(this).css("backgr

正如你在这里看到的:,它是朝着左-右的方向工作的。我想做完全相反的事情;从右到左。 我该怎么做?thx

$(".inno-bg").mouseenter(function(){
    $(this).find("h2").stop(true, true).animate({
        'marginTop': "-=60px"
    }, 200);
    $(this).css('background-image', 'none');
    $(this).css("background-color", "#1A6397");
    $(this).stop(true, false).animate({ width: "320px" });
    $(this).find("p").fadeIn( 1000 );
});

$(".inno-bg").mouseleave(function(){
    $(this).find("h2").stop(true, true).animate({
        'marginTop' : "+=60px"
    }, 200);
    imageUrl = "http://www.esa.int/var/esa/storage/images/esa_multimedia/images/2014/02/gaia_calibration_image/14263603-2-eng-GB/Gaia_calibration_image_node_full_image_2.jpg";
    $(this).css('background-image', 'url(' + imageUrl + ')');
    $(this).stop(true, false).animate({ width: "160px" });
    $(this).find("p").hide();
});

当从右向左设置任何对象的动画时,您需要将其绝对放置在其容器中。这是因为默认情况下,元素被设置为左上角,需要更改为右上角。尝试此操作,请注意,我只在此处包含我更改/添加的属性:

.row {
    position: relative;
}
.inno-bg {
    position: absolute;
    top: 0;
    right: 0;
}

thx很多,如果您对jquery部分有更好的建议,请让我知道:)