• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Drag item in browser?

Is there any way to drag an on-screen item in the web browser?

I was at a site that wanted me to "drag items to reorder", & I couldn't do it. Dragging only scrolled the screen. I found a suggestion about a similar issue to use a "pinch", but all that does is zoom.

I get the same behavior in Skyfire & in the default browser.
 
Sorry, can't post a link. The only one I know of was the one I encountered, and it was a single page of a multi-page survey.

In case it wasn't clear, "reorder" is in the sense of ranking, not of buying again.

I did contact "support" at that site, pointing out the problem with that interface paradigm....

Thanks for the interest, at least.
 
I don't have an Optimus V, but this came up when I was about to post a similar question in another forum. Does anyone have an answer? Even if it cant' be done with the native browser, are there any other browsers that support a drag function?
 
To answer the question, such a feature must be implmented by the developer who makes the website. Javascript has to be used to prevent the default action when the mouse button is clicked down (this is equivalent to putting your finger on the screen on mobile devices). When the mouseDown event is fired by putting your finger on the screen, then there must also be code that will detect mouse position on the screen (your finger) to be able to update the position of the draggable item.

To see an example of a website where the default action for mouseDown has been prevented and thus lets your finger interact with the website, see this:
three.js canvas - geometry - cube

Notice that you can drag the cube without dragging the screen with your finger.

The code used for that looks like this:

Code:
			function onDocumentMouseDown( event ) {

				event.preventDefault();

				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
				document.addEventListener( 'mouseup', onDocumentMouseUp, false );
				document.addEventListener( 'mouseout', onDocumentMouseOut, false );

				mouseXOnMouseDown = event.clientX - windowHalfX;
				targetRotationOnMouseDown = targetRotation;
			}

So to answer RolandTumble's question, it works when the developer takes into account that he will have users on mobile devices viewing his site and takes appropriate action in his code.
 
Back
Top Bottom