I am creating an HTML page . The page has 2 divs
a)one is a sidebar which has images in it.
b) the second div is canvas onto which images from the div1 will be dragged and dropped.
Now in the canvas , i have a grid as background(sort of like graph paper with each square of like 25px ). The images will be have to be dragged onto canvas in the exact squares(on graph paper like 3 from top border,2 from right ) . If users drops images onto exact squares ,nothing happens . But if image is dropped onto wrong square a JS alert should pop up.
Now i have been able to drag and drop images from div 1 to div 2 but i need to know how i can check if image from div1 is dropped onto right square in canvas?
posted 3 years ago
Compare the dropped elements position relative to the canvas and check if it would fit.