【问题标题】:How to remove extra space inside of jQuery UI dialog box如何删除 jQuery UI 对话框内的多余空间
【发布时间】:2016-07-21 11:00:03
【问题描述】:

这是我的对话框

我想删除或移除对话框内多余的空格。我怎样才能实现它?

更多详情请点击我的HTML

<div id="beneficiaries_window">
  <?php
    $sql1 = "SELECT * FROM beneficiary WHERE id = '$id'";
    $result1 = mysql_query($sql1);
  ?>
  <table style="border: 2px solid black;margin:auto;">
    <tr>
      <th><center>Name<center></th>
      <th><center>Action</center></th>
    </tr>
  <?php             
    while($row1 = mysql_fetch_array($result1)){
      echo "<tr class='beneficiaries_rows' id='".$row1['id']."'>";
      echo "<td>".$row1['name']."</td>";
      echo "<td>";
      echo "<button class='edit_beneficiaries'>EDIT</button>";
      echo "<button class='del_beneficiaries'>X</button>";
      echo "</td><br/>";
      echo "</tr>";
    }
  ?>
  </table>
  </div>
  <button class="beneficiaries" name="beneficiaries">Beneficiaries</button>

jQuery脚本

jQuery("#beneficiaries_window").dialog({
  modal: true,
  resizable: false,
  draggable: false,
  autoOpen: false,
  buttons:[{
    text: "Close",
    click: function(){
      jQuery(this).dialog("close");
    }
  }]
});

//beneficiaries open dialog
jQuery(".beneficiaries").click(function(event){
  jQuery("#beneficiaries_window").dialog("open");
    event.preventDefault();
  });

但在我的 firebug 中,我看到了这个 &lt;br&gt;'s,但它们在 &lt;div&gt; 内没有 &lt;br&gt;

我怎样才能删除这个对这个额外间距一无所知的我?

【问题讨论】:

    标签: javascript jquery html jquery-ui jquery-ui-dialog


    【解决方案1】:
    $('#div_id').dialog({
            title   : 'Add User',
            position: { my: "center", at: "center", of: window },
            width   : 1000,
            height  : 500,
            modal   : true,
            closeOnEscape: false
        });
    

    您可以在其中定义宽度,高度,相应地定义其宽度。

    【讨论】:

    • 我给我的身高一个 150 但即使我做到了,额外的间距仍然是他们的 20 它给了我滚动,但额外的空间仍然存在他们的。
    • 检查 dom,如果 div 有一些填充。
    • 我明白了,先生,谢谢。我回应 &lt;br&gt; 这就是为什么它有额外的间距
    【解决方案2】:

    因为&lt;br&gt;,它有额外间距的原因

    <?php             
    while($row1 = mysql_fetch_array($result1)){
      echo "<tr class='beneficiaries_rows' id='".$row1['id']."'>";
      echo "<td>".$row1['name']."</td>";
      echo "<td>";
      echo "<button class='edit_beneficiaries'>EDIT</button>";
      echo "<button class='del_beneficiaries'>X</button>";
    
      echo "</td><br/>";          <----THIS <br/> make the extra spacing
    
      echo "</tr>";
    }
    

    ?>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-28
      • 2012-02-11
      • 1970-01-01
      • 1970-01-01
      • 2014-08-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多