Animating marginLeft with jQuery

后端 未结 3 1223
予麋鹿
予麋鹿 2021-01-03 22:46

I can\'t figure out to animate marginLeft with jQuery. I need it to subtract 938px every time a user clicks on a link, which was working fine when I was using .css()

3条回答
  •  鱼传尺愫
    2021-01-03 22:55

    There's a syntax error in your code, as you are passing parameters in an object to animate() you should use : not , to delimit each attribute. Try this:

    $("#full-wrapper #full").animate({
        marginLeft: '-=938px'
    }, 500);
    

    Example fiddle

提交回复
热议问题