atrueresistance
atrueresistance

Reputation: 1368

jQuery slideToggle() moves

I have a slideToggle that shows/hides a table.

jQuery

$("#featMoreInfo").click(function() {    
    $("#featben2").slideToggle('slow');
    var txt = $(this).text() == '+ More Info' ? '- Minimize' : '+ More Info';
    $(this).text(txt);
});
$("#featMoreInfo2").click(function() {
    $('html, body').animate({ scrollTop: 0 }, 'slow');
    $("#featben2").slideToggle('slow');
    $("#featMoreInfo").text('+ More Info');
});

I have a javascript tooltip in some of the columns. Occationally whenever you click + More Info the alignment gets thrown off. Has anyone had this issue before?

Sometimes Good Slide

Sometimes Bad Slide

Upvotes: 0

Views: 366

Answers (1)

Stefan Burt
Stefan Burt

Reputation: 181

This is a known bug with jQuery, http://api.jquery.com/slideToggle/#comment-82454830, its due to jQuery being unable to calculate and render their correct height of table row / cells.

I've had this problem in a project and ended up using another effect as it was unstable and so wasn't fit for production.

Did a quick search and found a post by spankmaster79 who answered this question and suggested a fix so this post might be worth a read. jQuery slideToggle jump on close

Upvotes: 1

Related Questions