How to make this jQuery snippet work in Internet Explorer?

后端 未结 2 1907
执念已碎
执念已碎 2021-01-21 08:30

If there was ever a time to hate IE, this is it. This code begins with a box with content. When the button is clicked, the box is supposed to drop down and fade-in.



        
相关标签:
2条回答
  • 2021-01-21 08:41

    Because you are missing the <head> tag and doctype declaration, your page is being rendered in Quirks Mode. Change this

    <html>
    

    to this

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
    
    0 讨论(0)
  • 2021-01-21 08:57

    I assume what you mean is that in IE, the item's height won't change. The element's height doesn't seem to get set to 0 properly. It works in my IE8 when I change

    $('#test').height(0);
    

    to

     $('#test').height(1);
    

    I don't know why this is. The documentation on height() does not mention any IE specific quirks.

    0 讨论(0)
提交回复
热议问题