简体   繁体   English

为什么该脚本在IE6中不起作用?

[英]why does this script not work in IE6?

I've been working on and off on a horizontal accordion. 我一直在研究和开发水平手风琴。 It's not working perfectly at the moment but i've just got to change a few bits. 目前尚不能完美运行,但我只需要更改一些内容。 The code is very rough and I intend to make it a bit more graceful once it works. 代码很粗糙,我打算在工作后使其更加优美。

It functions perfectly in every browser apart from ie6..initially when it loads in the page all you can see is the 6th panel (labelled df6)...then if you click on that the accordion seems to spring in to life....all the panels appear and it seems to work just fine. 它在除了ie6之外的所有浏览器中都可以正常运行。最初,当它加载到页面中时,您可以看到的仅是第6个面板(标记为df6)...然后,如果单击该按钮,则手风琴似乎应运而生... 。所有面板都出现了,并且似乎工作正常。 I can't think of any reason for this.. 我想不出任何原因。

Any ideas? 有任何想法吗? I'm at a complete loss with this :( 我对此完全不知所措:(

http://boudaki.com/testing/carousel/test.html http://boudaki.com/testing/carousel/test.html

Ah! 啊! Thankyou Elf King! 谢谢精灵王! Your comment about jquery and IE6 led me to a google search which turned up another stack overflow post: 您对jquery和IE6的评论使我进入了Google搜索,这又引发了另一个堆栈溢出帖子:

jQuery $(document).ready() failing in IE6 jQuery $(document).ready()在IE6中失败

It seems moving my script to the bottom of the page and removing the document.ready fixed it!! 似乎将我的脚本移到页面底部并删除了文档。已将其修复!!

Many thanks and apologies I should have googled this more thoroughly :) 非常感谢和歉意,我应该更彻底地在Google上搜索它:)

For me this did not work well in IE7 either! 对我来说,这在IE7中也不起作用! However, I was able to make it work properly by setting the id's of the list items in the markup. 但是,我可以通过在标记中设置列表项的ID使其正常工作。 Element ID's shouldn't be the kind of things change often, so perhaps this can be done, rather that set it in the onload function... Is there some reason you were doing it that way? 元素ID不应经常更改,因此可以做到这一点,而不是在onload函数中进行设置...是否有某些理由要这样做?

<body>          
 <ul id="accordion">     
  <li id="handle1">
    <a href="#">df1</a>
    <div>content1
    </div>
  </li>     
  <li id="handle2">
    <a href="#">df2</a>
    <div>content2
    </div>
  </li>       
  <li id="handle3">
    <a href="#">df3</a>
    <div>content3
    </div>
  </li>        
  <li id="handle4">
    <a href="#">df4</a>
    <div>content4
    </div>
  </li>         
  <li id="handle5">
    <a href="#">df5</a>
    <div>content5
    </div>
  </li>               
  <li id="handle6">
    <a href="#">df6</a>
    <div>content6
    </div>
  </li>        
</ul>       

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM