简体   繁体   中英

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. 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

Ah! Thankyou Elf King! Your comment about jquery and IE6 led me to a google search which turned up another stack overflow post:

jQuery $(document).ready() failing in 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 :)

For me this did not work well in IE7 either! However, I was able to make it work properly by setting the id's of the list items in the markup. 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?

<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>       

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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