Trello, on the desktop website, allows you to drag elements around like this:
However, when using Safari on iOS, this doesn't work.
It either selects the element or pops up a sheet.
If I present this in a UIWebView or WKWebView, can I make the WebView act more like desktop Safari, so that I can drag the elements around?
I've discovered I can stop various iOS actions by sending the webview some javascript:
// stop selection
webView.stringByEvaluatingJavaScriptFromString("document.documentElement.style.webkitUserSelect='none';")
// stop copy/paste etc
webView.stringByEvaluatingJavaScriptFromString("document.documentElement.style.webkitTouchCallout='none';")
// stop loupe
webView.stringByEvaluatingJavaScriptFromString("document.body.style.webkitUserSelect='none';")
But this still doesn't let me drag elements around.
Is there a solution?
(I know there is a Trello app, I'm just curious if this is possible with WebView)
-webkit-user-drag:
is an option. But that has to be done for the respective element.. In iOS, the scroll will clash with the drag. Normally disabling scrollview'sscrollEnabled
andbounces
property would allow dragging. I don't think that is a viable solution for you here for two reasons.. Firstly, i think the board themselves scroll. So chances are the above mentioned option may not work and secondly It would be difficult to use a website as trello on a phone without being able to scroll . – Subbutouch*
events and fire the correspondingmouse*
events (don't forget to copy all X and Y data, and callpreventDefault
ontouchmove
to prevent page scrolling while dragging, but only draggable elements, otherwise scrolling & zooming is not gonna work) and 2. manually enable dragging on Trello, because they disable is for mobile devices (search forisTouch()
in their JS files). They use jQueryUI's draggable & droppable, but they somehow use droppable for the draggables... and everything is wrapped inside a gazillion closures. – Siguza