代码之家  ›  专栏  ›  技术社区  ›  Z. Zlatev

jqueryui:sortable<thead>messes up ie any ie when table's css display property is set to relative

  •  0
  • Z. Zlatev  · 技术社区  · 14 年前

    正如标题所描述的,大部分问题。下面是在firefox中按预期工作的示例代码。有人能提供解决方法吗? In action

    javascript

    $(function()
      {
        $('table thead').sortable({
          items: 'th',
          containment: 'document',
          helper: 'clone',
          cursor: 'move',
          placeholder: 'placeHold',
          start: function(e, ui) {
            $overlay=$('<div>').css({ position: 'fixed', left: 0, top: 0, backgroundColor: 'black', opacity: 0.4, width: '100%', height: '100%', zIndex: 500 }).attr('id','sortOverlay').prependTo(document.body);
            $(this).parent().css({ position: 'relative', zIndex: 1000});
          },
          stop: function(e, ui){
            $('#sortOverlay').remove();
            $(this).parent().css({ position: 'static' });
        }
        });
    });
    

    CSS

    <style type="text/css">
      table {
        background-color: #f3f3f3;
      }
      table thead {
        background-color: #c1c1c1;
      }
      .placeHold {
        background-color: white;
      }
    </style>
    

    HTML

    <table>
        <thead><th>th1</th><th>th2</th><th>th3</th><th>th4</th></thead>
        <tbody>
          <tr>
            <td>content</td><td>content</td><td>content</td><td>content</td>
          </tr>
        </tbody>
      </table>
    
    1 回复  |  直到 5 年前
        1
  •  0
  •   Community kfsone    7 年前

    此问题已在此处回答: Why is my thead not appearing in Internet Explorer?

    您将<th>元素直接包含在<thead>组中,这实际上是不合法的。您必须将它们括在<tr>元素中,并将其放入<thead>…