Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 div,我想在浏览器宽度增加时以 2 为增量增加 marginTop,而在宽度减少时以 2 为增量减少。我不确定如何做到这一点,但这应该很容易。感谢您对此的任何帮助。
用这个:
$(window).resize(function() { // your code goes here });