JavaScript fonts
Allows to define the JavaScript code that will work over the menu or the page. It can be useful to define additional behaviors for the menu
or even a menu structure different from the default.
If the default JavaScript is disabled, in the option "Setup", it can include a code that manipulates the information of the menu tree and create a new menu, for example, the following code uses the functions of the YUI library included in Moodle to generate a simple menu bar, similar to the default menu but without effect on the scrolling of submenus:
var menu_ppal_topics = new YAHOO.widget.MenuBar("id_contenedor_menu");
menu_ppal_topics.render();
The example shows the easiest way of the popup menu, however, it can make many more customizations using the functions of the YUI library.
Notes:
- The name id_contenedor_menu corresponds to the div identifier that contains the menu in HTML created as nest lists, usually with the tags HTML: ul y li.
- When the default JavaScript is included, the variable tree_menu_var contains the object JSON with the menu data.
- The JSON's structure and the information about how customize the menu can consult in the YUI's reference manual following this link.
- It is possible that to make changes in the JavaScript, they cannot visualize immediately in the course. If so, it must refresh the page. In many browsers, you can do it pressing the key combination Ctrl+F5.