SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict WarpNacelle's Avatar
    Join Date
    Aug 2005
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JQuery slideToggle question

    As I've been progressing down the road from JQuery grasshopper to Ninja, I tried the slideToggle method on a table row and noticed that, after it toggled back into view after hiding the row, it added:

    Code:
    style="display: block"
    to the table row:

    HTML Code:
    <tr class="gallery" style="display: block">
    This actually breaks the intended display of the table. Is there a way to remove that or at least set it to a 'display' value that won't break the table?


  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by WarpNacelle View Post
    This actually breaks the intended display of the table. Is there a way to remove that or at least set it to a 'display' value that won't break the table?
    That's a known slideToggle bug.

    The work-around is to use the callback to set the display type back to a table-row.

    Code javascript:
    $('#tableRowId').slideToggle(function () {
        $(this).css('display', 'table-row');
    });
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Addict WarpNacelle's Avatar
    Join Date
    Aug 2005
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah! Excellent. Thanks!



Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •