gpt4 book ai didi

jquery - 在 jQuery 中向上滑动的元素在 IE 8 中被弄乱了

转载 作者:太空宇宙 更新时间:2023-11-03 19:01:14 25 4
gpt4 key购买 nike

我创建了一个常见问题解答部分,它在 Chrome 和 Firefox 中很好,但在 IE 8 中,当向上滑动时,元素似乎失去了底部边距。

我准备了一个 fiddle ,但它似乎有一个不同的问题,甚至在 Chrome 中看起来很乱,显示多个底部边框。

我想看看有没有人知道为什么会这样?

fiddle :http://jsfiddle.net/4vYLb/

HTML

<div id="faq-q-a">

<div class="question-wrapper">
<h3>This is the first question?</h3>
<div class="answer">
<p>Morbi et arcu eget dolor tempor volutpat. Mauris a leo dolor, vitae cursus diam. Morbi faucibus convallis rutrum. </p>
</div>
</div>

<div class="question-wrapper">
<h3>This is the second question?</h3>
<div class="answer">
<p>Morbi et arcu eget dolor tempor volutpat. Mauris a leo dolor, vitae cursus diam. Morbi faucibus convallis rutrum. </p>
</div>
</div>

<div class="question-wrapper">
<h3>This is the third question</h3>
<div class="answer">
<p>Morbi et arcu eget dolor tempor volutpat. Mauris a leo dolor, vitae cursus diam. Morbi faucibus convallis rutrum. </p>
</div>
</div>

</div>​

jQuery

$('#faq-q-a h3').each(function() {
var h3 = $(this);
answer = h3.next('.answer').hide().css('height','auto').slideUp();

h3.click(function() {
h3.parent('.question-wrapper').toggleClass('active');

if (h3.parent('.question-wrapper').is('.active')) {
h3.next('.answer').slideDown('slow');
}
else {
h3.next('.answer').slideUp('slow');
}
});
});

CSS

#faq-q-a {
position: relative;
margin: 10px 0 10px 10px;
padding: 0 0 0 22px;
}

.question-wrapper {
background-color: #e5e5e5;
border: 1px solid #cccccc;
margin-bottom: 20px;
padding: 5px 0 5px 25px;
width: 420px;
background: #e5e5e5;
}

.question-wrapper.active {
background-color: #ffffff;
background: #ffffff;
}

#faq-q-a h3 {
cursor: pointer;
color: #408261;
font-weight: bold;
font-family: arial, Helvetica;
font-size: 14px;
margin-bottom: 10px;
}

#faq-q-a div.answer {
position: relative;
height: 0;
overflow: hidden;
}

#faq-q-a div.answer p {
padding: 0;
margin: 0;
font-family: arial, Helvetica;
color: #555;
font-size: 12px;
width: 300px;
}​​

最佳答案

将以下内容添加到 .question-wrapper CSS:

overflow: hidden;

更新 fiddle :http://jsfiddle.net/johnkoer/4vYLb/1/

关于jquery - 在 jQuery 中向上滑动的元素在 IE 8 中被弄乱了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11990371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com