Giacomo Balli profile picture
Giacomo Balli
The Mobile Guy

Over two decades of experience at your service.
I help business owners make better decisions.

Let's Chat LinkedIn

Context menu with web technologies for PhoneGap

I noticed in the PhoneGap Developer Forums a question that doesn't get asked frequently (unlike many others). Industry Expert Simon MacDonald had a classy answer for Android specific case but I figured many would benefit from a more neutral approach which uses solely web technologies (HTML, CSS & JavaScript) to be used within PhoneGap.
You can find the page which is both demo and source code here (demo only works on touch enabled devices but can be extended to clicks). Context Menu for PhoneGapThe concept is quite simple. Every time the user starts touching a section of the screen, a timer get started. This gets canceled as soon as the the finger moves or lifted. If the time elapses and the finger didn't move, it will display the context menu right under the the finger. In the example, a delay of 1.5s is being used.
This should be seen as a very barebones starting point on top of which you can build all the bells & whistles or additional functionality (and design) you want.
Hope it helps!
 

#code, #phonegap
Published: Tue, May 14 2013 @ 14:51:40
Back to Blog