Is it possible to create such "tilted menu" (please see below) using JavaScript ?
Provided that I would like them to be "relative" to resize appropriately to a screen size.
Is it possible to create such "tilted menu" (please see below) using JavaScript ?
Provided that I would like them to be "relative" to resize appropriately to a screen size.
This can be done using the
<canvas>
element of HTML5 and JQuery. By using the canvas element, you can draw parallelograms on top of one another with text in every other parallelogram.This does have the drawback of needing to handle the clicks on each item by determining if it fell within one of the parallelograms, but it is the only way I know to do this.
HTML
JQuery
You can see this code working in this JSFiddle.
To keep sizes relative to the screen size, you will need to replace the hardcoded values with values determined by the size of the
$("#menu")
div.You will also want to create a method to draw the parallelograms to make adding additional menu items much simpler.
You can use CSS transforms do this, and with some other hacks ..