Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found a solution. </p> <p>It seems that only jquery's .slideUp() function is causing the problem when setting the height back to 0px. The bug only seems to appear when the browser is working in QuirksMode (HTML Transitional 4.01 DocType) and on IE. The solution I found <a href="http://siderite.blogspot.com/2009/08/jquery-slideup-flickers-in-internet.html" rel="nofollow noreferrer">here</a> is a replacement for .slideUp(). So instead of </p> <pre><code>targetElement.slideUp(speed,callBack) </code></pre> <p>you write</p> <pre><code>var h = target.height(); var cssHeight=target.css('height'); target.animate({ height: '1px' }, speed, function() { target.hide(); target.height(h); target.css('height',cssHeight); callBack(); }); </code></pre> <p>Thx to Siderite Zackwehdex wo also reported the bug to jQuery (<a href="http://dev.jquery.com/ticket/5062" rel="nofollow noreferrer">http://dev.jquery.com/ticket/5062</a>), but they won't fix it. They said:</p> <blockquote> <p>you can just made sure that your document isn't in quirksmode (provide a proper doctype) - which is what we typically recommend when encountering this issue.</p> </blockquote> <p>I also found a fix, or replacement for .slideToggle() for everyone who doesn't have the time or control over the HTML to fix it and make it "QuirksMode Clean".</p> <p><a href="http://blog.pengoworks.com/index.cfm/2009/4/21/Fixing-jQuerys-slideDown-effect-ie-Jumpy-Animation#c25072856-19B9-FE20-6C734F2EC43461CC" rel="nofollow noreferrer">Here</a> you'll find an explanation and function that works like a charm. The only change I had to make, was setting the height to '1px' so it won't jump open on the first run of .slideToggle() if elements are hidden from the beginning on. </p> <p>So my working solution finally looks like this:</p> <pre><code>// this is a fix for the jQuery slide effects function slideToggle(el, bShow){ var $el = $(el), height = $el.data("originalHeight"), visible = $el.is(":visible"); // if the bShow isn't present, get the current visibility and reverse it if( arguments.length == 1 ) bShow = !visible; // if the current visiblilty is the same as the requested state, cancel if( bShow == visible ) return false; // get the original height if( !height ){ // get original height height = $el.show().height(); // update the height $el.data("originalHeight", height); // if the element was hidden, hide it again if( !visible ) $el.css({height: '1px'}).hide(); } // expand the knowledge (instead of slideDown/Up, use custom animation which applies fix) if( bShow ){ $el.show().animate({height: height}, {duration: 500}); } else { $el.animate({height: '1px'}, {duration: 500, complete:function (){ $el.hide(); } }); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload