jQuery Accordion:IE 动画问题 [英] jQuery Accordion: IE animation issues

查看:17
本文介绍了jQuery Accordion:IE 动画问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将其设为社区维基,原因有以下三个:

I am making this a community wiki, for three reasons:

  • 我觉得我没有得到明确的答案,但是
  • 我早就不再需要答案了,因为我已经推出了自己的手风琴功能
  • 这个问题获得了大量浏览量,所以显然很多人仍然感兴趣

因此,如果有人想更改/澄清这个问题并使其成为权威指南,请成为我的客人.

So if anybody wants to change/clarify this question and make it a definitive guide, be my guest.

我正在使用 jQuery 的 accordion UI 元素处理页面.我在该示例中为我的 HTML 建模,除了在 <li> 元素中,我有一些无序列表的链接.像这样:

I'm working on a page using jQuery's accordion UI element. I modeled my HTML on that example, except that inside the <li> elements, I have some unordered lists of links. Like this:

  $(document).ready(function() {
     $(".ui-accordion-container").accordion(
        {active: "a.default", alwaysOpen: true, autoHeight: false}
     );
  });

  <ul class="ui-accordion-container">
  <li> <!-- Start accordion section -->
   <a href='#' class="accordion-label">A Group of Links</a>
   <ul class="linklist">
      <li><a href="http://example.com">Example Link</a></li>
      <li><a href="http://example.com">Example Link</a></li>
   </ul>

   <!--and of course there's another group -->

问题:IE 动画很烂

虽然 IE7 动画文档的示例手风琴菜单很好,但它有我的问题.具体来说,页面上的一个手风琴菜单会突然移动并且内容闪烁.我知道这不是 CSS 问题,因为如果我不包含我的 CSS 文件也会发生同样的事情.

页面上的另一个手风琴菜单会打开您单击的第一个部分,然后不会打开任何一个部分.

The other accordion menu on the page opens the first section you click and, after that, won't open any of them.

这两个问题都是 IE 特有的,如果我使用选项 animated: false,它们都会消失.但我想保留默认的 slide 动画,因为它可以帮助用户了解菜单在做什么.

Both of these problems are IE-specific, and both go away if I use the option animated: false. But I'd like to keep the default slide animation, since it helps the user understand what the menu is doing.

还有别的方法吗?

推荐答案

我感受到你的痛苦!我最近经历了一个荒谬的故障排除,我将母版页和页面布局中的所有内容逐块撕掉(这实际上是在 SharePoint 中),不断缩小页面.

I feel your pain! I recently went through a ridiculous troubleshoot where I tore everything out of the master page and page layout block by block (this was actually in SharePoint), continuously slimming down the page.

最终结果是没有 html 文档的文档类型(一些开发人员已将其删除).缺少文档类型意味着 IE 7 以 quirks 模式运行,而 JQuery Accordion 发出的内联 CSS 表现得很古怪.

The end result ended up being not having a doc type for the html document (some developer had removed it). The lack of a doctype meant that IE 7 was running in quirks mode and the inline CSS emitted by the JQuery Accordion was behaving funky.

考虑添加:

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

在您的母版页或 html 文档的顶部(如果尚未定义文档类型).

At the top of your masterpage or html document (if there's not already a doctype defined).

实际上有一个专门介绍 Quirks Mode 行为的站点.您可以在此处查看关于怪癖模式的文章.我写了一篇文章,里面有更多关于排除故障.

There's actually a whole site dedicated to Quirks Mode behavior. You can check out an article about Quirks Mode here. I wrote a post which has a little more surrounding information on the troubleshoot.

这篇关于jQuery Accordion:IE 动画问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆