Creating joystick in Javascript?

I wanted to create a joystick overlay on the game for maving player up, down, left, right and a shoot button on the right.

Is there some javascript library, or open source or direct support for this in cocos2d-x javascript ?

Thanks

These are done pretty easily in Cocos2d. Without writing your classes for you, here is how I would do it:

Make 2 classes, one called joystick.js, and the other called fireButton.js. These classes both extend cc.Layer

For the Joystick class:
create TouchEvent listeners for touchesEnter, and touchesMoved, and touchesEnded;
create a sprite of your joystick, and rig it up so it repositions itself according to the touchesMoved

For the FireButton class:
create TouchEvent listeners for touchesEnter, and touchesEnded;

Finally, in your main class, get both of these layers instantiated and added as childs. Scale them both to half the screen and put the joy on the left and the button on the right.

Lastly, make sure the swallowsTouches is set to FALSE on both classes, or you will have problems pressing both joystick and button at the same time.

If you want to see an example, look to your cocos2dJavascript samples directory under Samples->Src->TouchesTest