gpt4 book ai didi

css - css left 属性的最大允许负值是多少?

转载 作者:行者123 更新时间:2023-12-02 17:36:06 25 4
gpt4 key购买 nike

我有一个场景,我更新左值以显示 div 元素的特定部分。在我的例子中,div 元素的宽度很长。我使用 left 属性通过动画来回移动 div。

示例代码:

$('.slides .next').live('click', function(){
var pos = $(this).position();
var newLeft = (pos.left - 700);
$(this).animate({left: "-=left"}, 800);
// I also tried this instead of the above=> $(this).animate({left: newLeft}, 800);
});

在某些时候,左边的值会随着负值变大(比如:-8400px)。当超出这个范围时,左侧会自动变为 0px;

非常感谢任何帮助。谢谢

最佳答案

来自 MDN :

There is no official range of valid values. Opera supports values up to 2^15-1, IE up to 2^20-1 and other browsers even higher. During the CSS3 Values cycle there were a lot of discussion about setting a minimal limit to support: the latest decision, in April 2012 during the LC phase, was [-2^27-1; 2^27-1] # but other values like 2^24-1 and 2^30-1 were also proposed # #. The latest Editor's draft doesn't list a limit anymore.

关于css - css left 属性的最大允许负值是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26736023/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com