☞ Need help? I have an open spot for consulting in my schedule. Hire me.

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!

 

Context menu with web technologies for PhoneGap by
submit to reddit submit to hackernews