This project is read-only.
How to Build menu4web

You can review source code of a working example at http://menu4web.elementfx.com/d_sv.html.

1. Include a reference to m4w.js library:

<script src="m4w.js"></script>*

2. Assign menu style:

<script> m4w.sT="position: relative; alwaysvisible: true; font-size: 9pt; etd-padding: 3px; etd-padding-left: 11px; etd-padding-right: 11px;"; </script>

3. Create menu div, menu item and element:

<script>
m4w.id=100; // menu id
m4w.m(m4w.id, "", "", m4w.sT); // menu div
m4w.i(m4w.id, 1, "link.html", 110, "", ""); // menu item
m4w.e(m4w.id, 1, "Home", "background: #4C86B0; color: #FFFFFF;"); // menu element
</script>

Menu will probably have multiple items and each item may have several elements. Call m4w.i and m4w.e methods to create required items and elements.

4. Draw menu

<script> m4w.draw(); </script>

5. Repeat steps 2, 3, 4 for each sub menu you are creating:

<script>

m4w.sD="pos-left: 2px; font-size: 9pt; etd-background: #F2F0D2; etd-padding: 2px;";
m4w.sDB="border: 1px solid #777777;";

m4w.id=110; / / sub menu id
m4w.m(m4w.id, m4w.sDB, "", m4w.sD); / / sub menu div
m4w.i(m4w.id, 1, "link.html", "", "", ""); / / sub menu item
m4w.e(m4w.id, 1, "Downloads", "color: #000000;"); / / sub menu element

m4w.draw();

</script>

6. Beatify your code by rewriting repeating statements as methods and properties of m4w object.

Last edited Jan 1, 2013 at 3:18 PM by sn41, version 15

Comments

No comments yet.