A basic mechanism:
- Include jquery on your page
- Give your menu items ids like menuItem1, menuItem2 etc.
- Declare a counter varible in javascript and set it to 1.
use jquery to hide the current menu item: $("#menuItem"+counter).hide()
then add one to the counter test to see if the menuItem exists (see here[^]). If it doesn't, you have shown the last item, reset the counter to 1. Now show the net menuitem, code>$("#menuItem"+<i>counter</i>).show()
- Now loop. You can do this using either Javascript timing event[^] to call the function, or use jquery's
delay
method in the function in step 3, and have it call itself.
This won't be very smooth: to improve this get the next item first, show it, and use the
show
mehtod's callback to hide item that has just been finished with. See
http://api.jquery.com/show/[
^] for help how to do this. If you use the jquery delay you should add the recursive code to the callback.