javascript - AngularJS 1 - 切换选项卡时 CSS 崩溃

标签 javascript html css angularjs

加载时我的主页如下: enter image description here

最初,一些行使用 ng-class 填充了背景颜色(蓝色),这里是“row-answered-call”,如下所示:

<tr ng-repeat="item in list" ng-class="{'row-answered-call': item.state === 'active', 'row-hovered' : item.hovered, 'row-selected': item.selected," ng-mouseover="highlight(item)" ng-dblclick="goToDetails(item)">


.row-answered-call  {
    background-color: g-hover !important;
}

问题出现在我切换到下一个选项卡后,将类型列替换为用户照片(这也会增加行的高度)。我使用一个变量 (currentView) 来跟踪将呈现哪个 td:

<td ng-hide="currentView === 0" style="width: 8%">
    <div ng-if="item.type === CallTypes.VIDEO_CALL" class="table-group-thumb" style="background-image: url('{{item.thumbnailUrl}}')"></div>
    <div ng-if="item.type === CallTypes.MESSAGE" class="table-group-thumb"><img ng-src="{{ROOT_URL + ImagePaths.COLORED_MESSAGE}}" /></div>
    <div ng-if="item.type === CallTypes.VOICE_CALL" class="table-group-thumb"><img ng-src="{{ROOT_URL + ImagePaths.COLORED_VOICE_CALL}}" /></div></td>
<td style="width: 8%" ng-show="currentView === 0">
    <i ng-class="{'icon--guardian-phone': item.type === CallTypes.VOICE_CALL, 'icon--guardian-message': item.type === CallTypes.MESSAGE, 'icon--guardian-video-call': item.type === CallTypes.VIDEO_CALL}"></i>
</td>

enter image description here

CSS 现在崩溃了。行未正确填充颜色。我认为这是因为行的高度发生了变化,之后没有重新加载 css。 有谁知道这个问题请给我一些建议或想法来解决这个问题。

---更新于 2017 年 5 月 8 日 - 上午 11:41

我合并了 2 个 tds,并将 ng-hide 和 ng-show 更改为 ng-if。

<td style="width: 8%">
     <div ng-if="currentView !== 0 && item.type === CallTypes.VIDEO_CALL" class="table-group-thumb" style="background-image: url('{{item.thumbnailUrl}}')"></div>
     <div ng-if=" currentView !== 0 && item.type === CallTypes.MESSAGE" class="table-group-thumb"><img ng-src="{{ROOT_URL + ImagePaths.COLORED_MESSAGE}}" /></div>
     <div ng-if=" currentView !== 0 && item.type === CallTypes.VOICE_CALL" class="table-group-thumb"><img ng-src="{{ROOT_URL + ImagePaths.COLORED_VOICE_CALL}}" /></div>
     <i ng-if="currentView === 0" ng-class="{'icon--guardian-phone': item.type === CallTypes.VOICE_CALL, 'icon--guardian-message': item.type === CallTypes.MESSAGE, 'icon--guardian-video-call': item.type === CallTypes.VIDEO_CALL}"></i>
</td>

检查 HTML 以及这些 tr、td 没有发现任何问题,background-color 属性包含正确的值,但实际上 css 仍然像我上面的屏幕截图一样崩溃。

Thanks,
Ken

最佳答案

.ng类{ 溢出:隐藏

关于javascript - AngularJS 1 - 切换选项卡时 CSS 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43799409/

相关文章:

javascript - JQuery 查找 span 样式颜色以替换为颜色哈希

php - 有什么方法可以在没有 cron 的情况下在托管 Web 服务器上自动运行 PHP 脚本?

html - 如何在复选框左侧添加标签?

javascript - Mongoose 日期过滤器

javascript - 为什么在 javascript 中过滤扩展数组的类的对象调用它的构造函数?

javascript - 实时显示 mathjax 输出

javascript - 使用 droparea js 在 1 个页面中创建多个上传图像

jquery - 动态生成的 HTML/CSS 网页,将鼠标悬停在表格中时会调整其大小

html - 并排链接在悬停时增加了尺寸,而不会扰乱其他链接

jquery - 在合理的画廊布局中图像中间的中心图标