- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>MooTools Menu</title>
- <script type="text/javascript" src="mootools-core.js"></script>
- <script type="text/javascript" src="mootools-more.js"></script>
- <script type="text/javascript" src="mooefx.js"></script>
- <link href="style.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="sidebar">
- <ul><li><font class="main toggler">Tutorial</font></li></ul>
- <div class="togglable">
- <ul><li class="sub"><a href="p1.html">Ajax</a></li>
- <li class="sub"><a href="p2.html">CSS/HTML</a></li>
- <li class="sub"><a href="p3.html">Coldfusion</a></li>
- <li class="sub"><a href="p4.html">PHP/MySQL</a></li></ul>
- </div>
- <ul><li><font class="main toggler">Contact me</font></li></ul>
- <div class="togglable">
- <ul><li class="sub"><a href="http://woork.blogspot.com">Woork.blogspot.com</a></li></ul>
- </div>
- </div>
- </body>
- </html>
I seem to be having a problem with this. The inclusion of this method seems to mess with the CSS styling of the menu I am looking to use it for. The HTML looks like:
The CSS looks like:
- #sidebar {
- width:200px;
- font: 11px "Lucida Grande", "Arial", "Helvetica", "Verdana", "sans-serif";
- }
- #sidebar ul {
- list-style: none;
- }
- #sidebar a, #sidebar font.main {
- width: 130px;
- display: block;
- padding: 3px 5px 3px 40px;
- background: url(tab_small.png);
- margin: 4px 0;
- text-decoration: none;
- }
- #sidebar li.sub a {
- color: #555555;
- }
- #sidebar font.main {
- font-size: 17px;
- font-weight: bold;
- color: #000000;
- text-shadow: #888888 2px 2px 1px;
- background: url(tab_big.png);
- padding: 7px 5px 7px 40px;
- margin: 10px 0px 4px 0px;
- }
- #sidebar div {
- width: 250px;
- }
and the JavaScript looks like:
- window.addEvent('domready', function() {
- var MainMenus = $$('#sidebar li font.toggler');
- var SubMenus = $$('#sidebar div.togglable');
- SubMenus.set('slide',{
- duration:600,
- transition:Fx.Transitions.Back.easeIn
- });
- SubMenus.slide('hide');
- MainMenus.addEvent('click',function(e){
- e.stop();
- var index = MainMenus.indexOf(this);
- if(!SubMenus.some(function(content,i){
- var slide = content.get('slide');
- if(slide.open && i != index){
- slide.slideOut().chain(function(){SubMenus[index].slide('in')});
- return true;
- }
- })){
- SubMenus[index].slide('toggle');
- }
- });
- var SubMenuItems = $$('#sidebar li.sub');
- /*
- SubMenuItems.each(function(el) {
- var fx = new Fx.Morph(el,{ duration: 150, link:'cancel'});
- el.addEvents({
- 'mouseenter': function() { fx.start({
- 'margin-left': 10
- });
- },
- 'mouseleave': function() { fx.start({
- 'margin-left': 0
- });
- }
- });
- });
- */
- });
You'll notice that I'm looking to use two effects but even with the morph effect commented out I have the problem. If I remove the
- <script type="text/javascript" src="mooefx.js"></script>
Any help?
Edit: Also, this throws an error in IE8 and doesn't work in IE7 either.


