mootools 手风琴不工作

发布于 2024-10-09 06:27:07 字数 2070 浏览 5 评论 0原文

我一直想在mootools上尝试一下手风琴效果,但我无法让它工作,就像js根本没有加载

这是HTML代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
 <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    <title>BarDiJan - We Deliver</title> 
    <link rel="stylesheet" href="/stylesheets/reset.css" type="text/css" /> 
    <link rel="stylesheet" href="/stylesheets/style.css" type="text/css" /> 
    <script type="text/javascript" src="/javascripts/mootools-core-1.3-accordion.js"></script> 
    <script type="text/javascript" src="/javascripts/mootools-more.js"></script> 
    <script type="text/javascript" src="/javascripts/application.js"></script> 
 </head> 

<body>
    <div class="container"> 
    <div id="accordion"> 
  <h3 class="toggler">What we Do</h3> 
  <div class="element"> 
    <p>We are people who deliver professional quality identity to you, we have wide range of support.
    </p> 
  </div> 
  <h3 class="toggler">What we Did</h3> 
  <div class="element"> 
    <p>Under Construction</p> 
  </div> 
  <h3 class="toggler">What we Offer</h3> 
  <div class=""> 
    <ul> 
    <li>Web Design</li> 
    <li>Identity</li> 
    </ul> 
  </div> 
</div> 


    </div> 

  </body> 
</html> 

这是application.js代码

windows.addEvent('domready', function() {

var accordion = new Accordion($$('h3.toggler'),$$('div.element'), {
    display: 2,
    opacity: false,
    alwaysHide: true,
    onActive: function(toggler) { toggler.setStyle('color', '#929292'); },
    onBackground: function(toggler) { toggler.setStyle('color', '#000000'); }
  });
});

有什么吗我做错了吗?如果重要的话我也会使用 sinatra。

也感谢您的宝贵时间。 。 。

I've been wanting to try out the Accordion effect on mootools but I can't get it to work, it's just like the js doesn't load at all

this is the HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
 <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    <title>BarDiJan - We Deliver</title> 
    <link rel="stylesheet" href="/stylesheets/reset.css" type="text/css" /> 
    <link rel="stylesheet" href="/stylesheets/style.css" type="text/css" /> 
    <script type="text/javascript" src="/javascripts/mootools-core-1.3-accordion.js"></script> 
    <script type="text/javascript" src="/javascripts/mootools-more.js"></script> 
    <script type="text/javascript" src="/javascripts/application.js"></script> 
 </head> 

<body>
    <div class="container"> 
    <div id="accordion"> 
  <h3 class="toggler">What we Do</h3> 
  <div class="element"> 
    <p>We are people who deliver professional quality identity to you, we have wide range of support.
    </p> 
  </div> 
  <h3 class="toggler">What we Did</h3> 
  <div class="element"> 
    <p>Under Construction</p> 
  </div> 
  <h3 class="toggler">What we Offer</h3> 
  <div class=""> 
    <ul> 
    <li>Web Design</li> 
    <li>Identity</li> 
    </ul> 
  </div> 
</div> 


    </div> 

  </body> 
</html> 

This is the application.js code

windows.addEvent('domready', function() {

var accordion = new Accordion($('h3.toggler'),$('div.element'), {
    display: 2,
    opacity: false,
    alwaysHide: true,
    onActive: function(toggler) { toggler.setStyle('color', '#929292'); },
    onBackground: function(toggler) { toggler.setStyle('color', '#000000'); }
  });
});

Is there anything that I did wrong? Also I use sinatra if that matters.

Also thanks for your time. . .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的鱼塘能养鲲 2024-10-16 06:27:07

您忘记将 element 类添加到最后一个元素。

这是一个有效的jsfiddle: http://jsfiddle.net/arian/YqNuh/

You forgot to add the element class to the last element.

This is a working jsfiddle: http://jsfiddle.net/arian/YqNuh/

眉目亦如画i 2024-10-16 06:27:07
windows.addEvent('domready', function() {... 

你犯了一个错误,窗口,不是窗口;-)
所以 :

window.addEvent('domready', function() {... 
windows.addEvent('domready', function() {... 

you make a mistake, window, not windows ;-)
so :

window.addEvent('domready', function() {... 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文