I'm thinking about creating a blog where each post is represented by an image that users can drag around the page by holding the mouse down, but also click on to reveal the full blog post. Is it actually feasible to implement this? If it is, could anyone suggest some resources or examples to check out?
6 Answers
Yes, it’s doable, but examples might be tough to find. Think about how it could work on mobile devices, though! I suggest using an HTML5 canvas to avoid rendering issues—this will give you more control over the behavior you want.
Yes, a click requires the button to be pressed down and released in the same spot. You can attach drag events and use `preventDefault()` to avoid triggering regular clicks when dragging. MDN has great examples for implementing this!
You can set it up using JavaScript like this: on click, process the click normally. On mousedown, start tracking position and set a flag for dragging. Then on mousemove, check if the element has moved significantly (like more than 5px) to determine if it’s a drag situation. Finally, on mouseup, check if it moved or not to decide whether to process a click or drop action.
You might want to explore react grid libraries; 'react-grid-layout' is a solid choice!
Absolutely, it’s possible! Most websites allow you to click on links and drag them simultaneously. Just visualize a page where you can both engage and move elements. It’s a neat concept!
Thanks for confirming! I'll dive into some research based on this.
For sure, it’s possible, but it might lead to confusing user experience. Just keep that in mind as you design it!

Drag events can help here! Use 'ondragstart' and 'ondragend'—these trigger only after a drag motion starts, and you can set custom drag images, which is handy.