0

我正在为这个基于 CSS3 的手风琴开发一个 jQuery 后备。

但是,经过测试,我注意到它在 iOS5 或更低版本或 IE8 - IE6 中不起作用。意思是,手风琴的面板/幻灯片不会打开/向下滑动。

我在 jQuery 论坛上询问了一些人,但他们对它为什么不起作用感到困惑。一个人说这可能是因为我在我的 jQuery 中使用了 :animated,IE 和 iOS 不支持。但是,如果没有它,该人没有替代方法来重写我的代码。

我想要实现的是在选中输入(复选框)/单击标签后获取与 slideDown 对应的内容,然后在未选中输入/再次单击标签时获取与 slideUp 对应的内容。

有人可以帮我修复我的代码,以便它在 IE 和 iOS 中工作吗?

我真诚地感谢任何和所有的帮助。

先感谢您!

编辑:我正在寻找使用我的 HTML5 标记的 jQuery 解决方案。

4

1 回答 1

0

我知道这是花哨的 CSS3 和所有,但如果这是实现这一目标所需的那种糟糕透顶的无语义标记,我不会打扰。4行jquery,你就完成了:

标记:

<dl class="menu">
    <dt><a href="#">About Us</a></dt>
    <dd>
        <p>Well, the way they make shows is, they make one show. That show's called a pilot. Then they show that show to the people who make shows, and on the strength of that one show they decide if they're going to make more shows.</p>
    </dd>
    <dt><a href="#">How We Work</a></dt>
    <dd>
        <p>Like you, I used to think the world was this great place where everybody lived by the same standards I did, then some kid with a nail showed me I was living in his world, a world where chaos rules not order, a world where righteousness is not rewarded. That's Cesar's world, and if you're not willing to play by his rules, then you're gonna have to pay the price.</p>
    </dd>
    <dt><a href="#">References</a></dt>
    <dd>
        <p>You think water moves fast? You should see ice. It moves like it has a mind. Like it knows it killed the world once and got a taste for murder. After the avalanche, it took us a week to climb out. Now, I don't know exactly when we turned on each other, but I know that seven of us survived the slide... and only five made it out. Now we took an oath, that I'm breaking now. We said we'd say it was the snow that killed the other two, but it wasn't. Nature is lethal but it doesn't hold a candle to man. </p>
    </dd>
    <dt><a href="#">Contact Us</a></dt>
    <dd>
        <p>You see? It's curious. Ted did figure it out - time travel. And when we get back, we gonna tell everyone. How it's possible, how it's done, what the dangers are. But then why fifty years in the future when the spacecraft encounters a black hole does the computer call it an 'unknown entry event'? Why don't they know? If they don't know, that means we never told anyone. And if we never told anyone it means we never made it back. Hence we die down here. Just as a matter of deductive logic.</p>
    </dd>
</dl>​

jQuery:

$('.menu > dt > a').click(function(e) {
    e.preventDefault();
    $(this).parent().next('dd').slideToggle();
});

这是一个小提琴。

您可能可以将其调整为您的标记,但是上帝,您为什么要这样做?

于 2012-10-24T15:51:24.070 回答