jQuery Accordion: IE animation issues

后端 未结 16 1523
我寻月下人不归
我寻月下人不归 2020-12-25 14:39

Update

I am making this a community wiki, for three reasons:

  • I don\'t feel like I got a definitive answer, but
  • I have long since stopped nee
相关标签:
16条回答
  • 2020-12-25 15:06

    Change your anchor tags to SPAN tags. I was experiencing the same problem and that worked well. The same goes for DIV tags, IE trips out when those are in the accordion for some reason. Position:Absolute may also freak IE out, fyi

    0 讨论(0)
  • 2020-12-25 15:06

    Just change autoHeight: false to autoHeight: true --> it worked for me, but wasn't what I want...

    Find that putting min-height for IE7 solved the problem.

    0 讨论(0)
  • 2020-12-25 15:08

    I've actually avoided using the accordion plugin as I found it a little bit inflexible for my needs. I've found that the easiest and most flexible accordion is as simple as:

    var accordion = function(toggleEl, accEl) {
        toggleEl.click(function() {
            accEl.slideToggle(function() { });
            return false;
        });
    }
    

    for your example you would use it like this:

    $(document).ready(function() {
        new accordion($("a.accordion-label"), $("ul. linklist"));        
    });
    

    you can use this as a template and build in css class adding, callbacks and other useful stuff, but I've found that in the end it was much easier to do it this way than to dick around with the accordion plugin.

    EDIT: Sample code with a callback function

    var accordion = function(toggleEl, accEl, callback) {
        toggleEl.click(function() {
            accEl.slideToggle(callback);
            return false;
        });
    }
    
    $(document).ready(function() {
        new accordion($("a.accordion-label"), $("ul. linklist"), function() { /* some callback */ });        
    });
    
    0 讨论(0)
  • 2020-12-25 15:09

    I'm using JQuery 1.4 and found

    <!DOCTYPE html>
    

    is ok for IE6,Chrome too.

    0 讨论(0)
  • 2020-12-25 15:09

    I actually found the opposit of sebastien - I had min-heights on the internal content DIVs which were causing the jerky animation. I took them off and things improved. But I'm not sure how this interacts with autoheight - according to the syntax, mine is set to "false", but my accordion definitely seems to be ignoring that...

    0 讨论(0)
  • 2020-12-25 15:12

    I had a similar problem with an accordion in IE6 and IE7 where I was not using the default HTML structure for the accordion. Strangely enough, fixing the horizontal size of the accordion elements to a certain number of pixels cleared up the problems with the accordion animation. Why? I don't know. But I observed that the problems were specific to using autoHeight: true and the problems occurred at the end of the animation where I assume the height of the accordion elements is reset. And we all know IE cannot do math.

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