仅限firefox:TypeError:toggler未定义

时间:2013-03-22 16:11:59

标签: mootools accordion

我拼凑了一些mootools手风琴代码已经工作了几年但是突然我注意到firefox打破了它 - 在safari,chrome或IE中没有问题。

http://jordanrossfilms.com

控制台显示:TypeError:toggler在这里未定义:

toggler.setStyle(' color','#666');

我想它的东西非常简单,但对于这个新手,我不知道是什么导致这个?有帮助吗?完整的代码如下:

window.addEvent('domready', function() {
var myAccordion = new Accordion($('accordion'), 'h1.toggler', 'div.element', {
    display: -1,
    opacity: true,
    alwaysHide: true,
    onActive: function(toggler, element){
        toggler.setStyle('color', '#df1a00');

        //remove the toggler hover events to clear out its events when it was inactive
        toggler.removeEvents('mouseenter');
        toggler.removeEvents('mouseleave');

        //then add your events again
        toggler.addEvent('mouseenter',function()
        {
          //...
        });
    },
    onBackground: function(toggler, element){
        toggler.setStyle('color', '#666');

        //remove the toggler hover events to clear out its events when it was active
        toggler.removeEvents('mouseenter');
        toggler.removeEvents('mouseleave');

        //then add your events again
        toggler.addEvent('mouseenter',function()
        {this.setStyle('color', '#df1a00');

        toggler.addEvent('mouseleave',function()
        {this.setStyle('color', '#666');

        });

        });
    }

});

var myAccordion2 = new Accordion($(' accordion2'),' h4.toggler',' div.element2',{         显示:-1,         不透明度:是的,         永远:真的,         onActive:function(toggler,element){             toggler.setStyle(' color','#df1a00');

        //remove the toggler hover events to clear out its events when it was inactive
        toggler.removeEvents('mouseenter');
        toggler.removeEvents('mouseleave');

        //then add your events again
        toggler.addEvent('mouseenter',function()
        {
          //...
        });
    },
    onBackground: function(toggler, element){
        toggler.setStyle('color', '#666');

        //remove the toggler hover events to clear out its events when it was active
        toggler.removeEvents('mouseenter');
        toggler.removeEvents('mouseleave');

        //then add your events again
        toggler.addEvent('mouseenter',function()
        {this.setStyle('color', '#df1a00');

        toggler.addEvent('mouseleave',function()
        {this.setStyle('color', '#666');

        });

        });
    }

});

var myAccordion = new Accordion($('accordion3'), 'h5.toggler', 'div.element3', {
    display: -1,
    opacity: true,
    alwaysHide: true,
    onActive: function(toggler, element){
        toggler.setStyle('color', '#df1a00');

        //remove the toggler hover events to clear out its events when it was inactive
        toggler.removeEvents('mouseenter');
        toggler.removeEvents('mouseleave');

        //then add your events again
        toggler.addEvent('mouseenter',function()
        {
          //...
        });
    },
    onBackground: function(toggler, element){
        toggler.setStyle('color', '#666');

        //remove the toggler hover events to clear out its events when it was active
        toggler.removeEvents('mouseenter');
        toggler.removeEvents('mouseleave');

        //then add your events again
        toggler.addEvent('mouseenter',function()
        {this.setStyle('color', '#df1a00');

        toggler.addEvent('mouseleave',function()
        {this.setStyle('color', '#666');

        });

        });
    }

});

});

1 个答案:

答案 0 :(得分:2)

我看到你正在使用mootools 1.2 mootools最近发布修复1.2导致firefox中的错误,因为新的firefox和mootools与String.concat冲突。

您可以看到关于它的Blog Post。 无论如何,尝试更新到新的1.2版本,看看它是否解决了问题