jQuery 动画向左。获取当前左侧位置

标签 jquery jquery-animate

我正在使用以下方式为 div 制作动画:

$('.twitterNav').click(function(){
        var maxLeft = $('#jsTwitter').width() - $('.tweet').width() -10;
        $('#jsTwitter').animate({
            left: $(this).attr('data-id')+'='+($('.tweet').width()+10),
          }, 100, function() {
            //alert($('#jsTwitter').attr('left'));
          });
    })

如何检索当前的左侧位置?

我以为我可以用 $('#jsTwitter').attr('left') 得到这个,但这只是返回 'undefined'

最佳答案

我明白了

$('#jsTwitter').css('left')

关于jQuery 动画向左。获取当前左侧位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11621419/

相关文章:

javascript - 如何让一个div适合100%的手机屏幕

javascript - 将数组传递给 jQuery $.post 减少位置

javascript - 始终检查语句更新

jquery、乘法选择器和 OR 函数

jquery - IE8在向div插入数据时强制兼容模式

javascript - 循环 jQuery 动画问题?

javascript - jQuery .animation() 函数运行两次并且不工作

javascript - 不要在点击时删除类(class)

jquery - 我可以使用变量显示通过 animate() 增加的 div 的宽度吗?

javascript - 使用 jQuery 同时向下滑动 div 和 .fadeIn() 内容,反之亦然?