在 drupal 中使用 jquery ui 手风琴时出现问题

发布于 2024-09-27 00:14:26 字数 1984 浏览 4 评论 0原文

我正在尝试在 drupal 页面上使用 jquery-ui 手风琴功能。我有多个团队,每个团队中有多个人,我想显示这些团队。我设置了一个按团队分组的视图,并且有每个团队成员的联系信息。我的手风琴似乎不起作用。我使用 从 jquery ui 模块导入正确的 js 文件,并且它显示在 js 文件中。

我想知道我是否有太多的 div 标签,这显然是弄乱了它。有谁看到任何可能影响这个的事情吗?

感谢您的任何想法。

这是一些示例代码 -

<div id="accordion">

<div>
      <h3><a href="#">Team: 1</a></h3>

     <p>

  <div class="views-field-title">
          <label class="views-label-title">
        Title:
      </label>
                <span class="field-content"><a href="/node/83">John Doe</a></span>
  </div>

  <div class="views-field-field-email-value">
          <label class="views-label-field-email-value">
        Email:
      </label>
                <span class="field-content">[email protected]</span>
  </div>

  <div class="views-field-field-phone-value">
          <label class="views-label-field-phone-value">
        Phone:
      </label>
                <span class="field-content">555-555-5555</span>
  </div>

  <div class="views-field-field-extension-value">
          <label class="views-label-field-extension-value">
        Extension:
      </label>
                <span class="field-content"></span>
  </div>

  <div class="views-field-field-role-value">
          <label class="views-label-field-role-value">
        Role:
      </label>
                <span class="field-content">Team Leader</span>
  </div>
    </p>

这是我的 jquery 手风琴调用 -

<script>
  $(document).ready(function() {
 $(function() {
  $( "#accordion" ).accordion();
 });
  });
  </script>

I am trying to use the jquery-ui accordion functionality on a drupal page. I have teams with multiple people in each team that I want to display. I have a view set up that groups by team, and has contact info for each team member. My accordion doesn't seem to be working. I used <?php jquery_ui_add('ui.accordion'); ?> to import the correct js file from the jquery ui module, and it is showing up in the js file.

I was wondering if I have too many div tags and that is shomehow messing with it. Does anyone see anything that may be affecting this?

Thanks for any thoughts.

Here is some sample code -

<div id="accordion">

<div>
      <h3><a href="#">Team: 1</a></h3>

     <p>

  <div class="views-field-title">
          <label class="views-label-title">
        Title:
      </label>
                <span class="field-content"><a href="/node/83">John Doe</a></span>
  </div>

  <div class="views-field-field-email-value">
          <label class="views-label-field-email-value">
        Email:
      </label>
                <span class="field-content">[email protected]</span>
  </div>

  <div class="views-field-field-phone-value">
          <label class="views-label-field-phone-value">
        Phone:
      </label>
                <span class="field-content">555-555-5555</span>
  </div>

  <div class="views-field-field-extension-value">
          <label class="views-label-field-extension-value">
        Extension:
      </label>
                <span class="field-content"></span>
  </div>

  <div class="views-field-field-role-value">
          <label class="views-label-field-role-value">
        Role:
      </label>
                <span class="field-content">Team Leader</span>
  </div>
    </p>

and here is my jquery accordion call -

<script>
  $(document).ready(function() {
 $(function() {
  $( "#accordion" ).accordion();
 });
  });
  </script>

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

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

发布评论

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

评论(2

暖树树初阳… 2024-10-04 00:14:26

我希望您已经弄清楚了,但这是我不久前写的解决方案...

http://www.cleaver.ca/content/jquery-ui-accordion-drupal-6

根据 jQuery 和 jQueryUI 的版本可能存在一些不兼容性,因此这可能有助于排序出去。有一个链接到我让它工作的网站

I hope you have figured it out already, but here's a solution I wrote up a while back...

http://www.cleaver.ca/content/jquery-ui-accordion-drupal-6

There can be some incompatibilities based on the version of jQuery and jQueryUI, so this may help sort things out. There's a link to the site where I got it workin

调妓 2024-10-04 00:14:26

首先,在对 jQuery 进行故障排除时,我发现缩小传递给它进行解析的任何 HTML 非常有用。接下来,您确定正在调用 UI 库吗?加载模块时尝试使用 drupal_add_js('/path/to/jquery.ui.js');

First off, when troubleshoot jQuery I have found it very useful to scale down any HTML that I pass to it to be parsed. Next, are you sure that the UI library is being called in. Try using drupal_add_js('/path/to/jquery.ui.js'); when you load your module.

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