通过mootools和joomla提醒

时间:2012-11-07 12:41:28

标签: joomla mootools

我必须尝试使用​​mootools和joomla 2.5非常简单的东西,但是不行。

当我点击菜单链接

时,我才能显示提醒

我只想显示警告,firebug没有重新调整任何错误,但没有显示警告。

 window.addEvent('domready', function() {
            var opt = {
                slides: 'sliders',
                duration: 1500,
                auto: true,
                delay: 5000,
                buttons: {next:'go-prev', prev:'go-next'},
                transition: Fx.Transitions.Quint.easeOut
            }
            var scroller = new QScroller('carrusel', opt);
            scroller.load();

          $$('.item-1 a').addEvent('click', function(event){
                alert('clicked!');
            });

        });
        </script>

<ul class="menu">
<li class="item-1">
<a href="/index.php/descripcion">Click here!</a></li>

</ul>

解决方案

window.addEvent('domready', function() {
$$('.item-1 a').addEvent('click', function(event){
                alert('clicked!');
            });

            var opt = {
                slides: 'sliders',
                duration: 1500,
                auto: true,
                delay: 5000,
                buttons: {next:'go-prev', prev:'go-next'},
                transition: Fx.Transitions.Quint.easeOut
            }
            var scroller = new QScroller('carrusel', opt);
            scroller.load();



        });
        </script>

2 个答案:

答案 0 :(得分:1)

$$('a').addEvent('click', function(event){
    event.stop();
    alert('clicked!');
});​

jsFiddle

尝试以上代码并告诉我

答案 1 :(得分:1)

您的代码有语法错误试试这个 -

JSFIDDLE

window.addEvent('domready', function(event) {
 $$('.item-1').addEvent('click', function(event){
                    alert('clicked!');
     event.stop();
 });
});