doubingling4706 2016-07-06 20:33
浏览 27

可见性:隐藏似乎不适用于IE,Chrome或Safari

In summary, Requirement: If data present populate div with text If not data present hide div but retain overall table vertical height

Implementation:

html:

<tr>
  <td>
    <div id= 'div_car_close_out' class='car_close_out'></div>
  </td>
</tr>

css:

div.car_close_out {
  border: 2px inset #D5D0D0;
  text-align: left ;
  overflow-y:scroll;
  height:35px;
  background-color: white;
}

javascript:

if (arr_task[0].CarClosedOutDate == " ") {
  document.getElementById("div_car_close_out").style="visibility:hidden";
} else {
  document.getElementById("div_car_close_out").innerHTML = arr_task[0].CarCloseOut;
  document.getElementById("div_car_close_out").style="visibility:visible";
}

This works perfectly in FF However in Chrome, IE and Safari div element is not hidden.

It is possible to use visibility:collapse, but then overall table vertical size is reduced, and positioning of elements below is not correct.

I've failed to find any solution to this seemingly simple requirement. Can any make any suggestions?

  • 写回答

2条回答 默认 最新

  • dongqi6964 2016-07-06 20:46
    关注

    The visible value of visibility property is supported for Chrome, Firefox, IE, Opera and Safari.

    However you can use visibilitY:initial, but it's no supported by IE.

    You can consult the Developer Mozilla Reference for detailed information about this property and his possibles values.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度