How to move rectangle on canvas
问题 I use canvas in my application using JavaScript. On that canvas I draw one rectangle. I want to move rectangle with the help of mouse(e.g moving slider) how to move that rectangle using JavaScript or J-query. 回答1: A Canvas is literally just a surface that you paint on and none of the things you paint are objects. If you want to pretend they are objects (like moving around a rectangle or a line) then you need to keep track of everything and do all the hit-testing and re-painting yourself . I