tags:

views:

86

answers:

1

Hi, I'm working in a joomla page. Joomla uses moo1.1, there's a new update 1.5.20, where we can actually upgrade mootools to 1.2. Unfortunately, many extensions still try to load 1.1 functions. So, I would like to know what changes can I make to make the following code work with Moo1.1:

http://www.php-help.ro/mootools-12-javascript-examples/javascript-drop-down-menu-using-mootools-12/

Here's the code,

window.addEvent('domready', function() {
    $('drop_down_menu').getElements('li.menu').each(function(elem) {
        var list = elem.getElement('ul.links');
        var myFx = new Fx.Slide(list).hide();
        elem.addEvents({
            'mouseenter': function() {
                myFx.cancel();
                myFx.slideIn();
            },
            'mouseleave': function() {
                myFx.cancel();
                myFx.slideOut();
            }
        });
    })
});

Thanks for looking ;D Any tip is appreciated!

A: 

for this particular bit of code, as far as i can tell, only myFx.cancel() will barf out - replace with myFx.stop();

$('drop_down_menu').getElements('li.menu').each(function(elem) {
    var list = elem.getElement('ul.links');
    var myFx = new Fx.Slide(list).hide();
    elem.addEvents({
        'mouseenter': function() {
            myFx.stop();
            myFx.slideIn();
        },
        'mouseleave': function() {
            myFx.stop();
            myFx.slideOut();
        }
    });
});

works with markup of:

<ul id="drop_down_menu">

    <li class="menu">
        <div class="trigger">mouseover me</div>

        <ul class="links">
            <li>foo</li>
            <li>foo 2</li>
        </ul>  
    </li>
</ul>

fiddle: http://www.jsfiddle.net/dimitar/HeUrV/

Dimitar Christoff