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.
如何拖动背景图像并更改其位置?就像您在 facebook 上更改封面照片的位置一样。
我到处搜索,但找不到合适的。
您可以尝试使用这个jQuery 插件,并且非常简单:
element.backgroundDraggable()
这里有一个演示
On mousedown,记录当前鼠标位置。创建一个蒙版,并在该蒙版上:
mousedown
mousemove
mouseup