Jquery slideToggle IE问题

时间:2009-10-28 16:56:23

标签: jquery internet-explorer slidetoggle

我让我的jquery slideToggle为Firefox工作。 好吧,它并不完美,因为当它向下滑动时,性能会有些跳跃。 我尝试了不同的解决方法,但没有人帮助过。

所以第一个问题是,什么可能导致我的代码中的这种小跳跃。

然后更大的问题是IE中的显示。 IE6和IE7。 隐藏的div在初始姿势中不会隐藏在IE中。 滑动行为也很奇怪。

我希望有人可以救我脱离这个......

只需使用firefox访问我的网站:

http://www.haus-plan.de/_01_Hausplan/

并检查它,然后将其与IE6& 7进行比较。

可以使用firefox或firebug访问源代码。

我希望任何人都可以提供帮助。

这里是我的jquery代码:

$(document).ready(function(){

//  Get height of all des before hide() occurs.  Store height in heightArray, indexed based on the de's position.
heightArray = new Array();
$("div.d_show_hide #de").each(function(i) {
  theHeight = $(this).height();
  heightArray[i] = theHeight;
});

// Hide all des
$("div.d_show_hide #de").hide();

//  When a tt is clicked, 
$("div.d_show_hide .tt").click(function () {
  //  Based on the tt's position in the div, retrieve a height from heightArray, and re-assign that height to the sibling de.
  $(this).next("#de").css({height: heightArray[$("div.d_show_hide .tt").index(this)]});
  //  Toggle the divideVisibility of the de directly after the clicked de
  $(this).next("#de").slideToggle("slow");
});

});

1 个答案:

答案 0 :(得分:0)

只需要强制元素的宽度!

<li><a href="#" id="sombra" onclick="$('#opt_1').slideToggle(360);">MUEBLES</a>
              <!-- just have to force the width of the elemet! -->
              <ul id="opt_1" style="display:none; width:164px;">

              <li id="imagen_superior"></li>
              <li><a href="salones-en-madrid-capital.php">SALONES</a></li>
              <li><a href="dormitorios-de-matrimonio-en-madrid-capital.php">DORMITORIOS</a></li>
              <li><a href="dormitorios-juveniles-en-madrid-capital.php">JUVENILES</a></li>
              <li><a href="muebles-de-cocina-en-madrid-capital.php">COCINAS</a></li>
              <li><a href="cuartos-de-bano-en-madrid-capital.php">BAÑOS</a></li>
              <li><a href="muebles-auxiliares-en-madrid-capital.php">AUXILIARES</a></li>
              <li><a href="sofas-en-madrid-capital.php">SOFÁS</a></li>
              <li><a href="mesas-en-madrid-capital.php">MESAS</a></li>
              <li><a href="sillas-en-madrid-capital.php">SILLAS</a></li>
              <li><a href="colchoneria-en-madrid-capital.php">COLCHONES</a></li>
              <li id="imagen_inferior"></li>
            </ul>