无法在html中添加垂直滚动条
Unable to add vertical scroll bar in html?
<body ng-app="myApp" ng-controller="myCtrl">
<div ng-show = "dataFromRest" ng-repeat = "x in dataFromRest.posts" >
<div class="tittle" style="width: 25%;">
<a href="" ng-click="showDiv = ! showDiv" style="text-decoration: none;" ># {{x.title}} </a>
<a href="" style="text-decoration: none;" ng-if="!x.title"># No title</a>
<hr style="color: red">
</a>
</b>
</div>
<div class="text">
<div style="width: 70% ;float:right; background-color: white;">
<div ng-show="showDiv">
<div style="float: right;">
<img id="currentPhoto" src="{{x.thread.main_image}}" onerror="this.src='noimageavailable.png'" width="300px" height="250px" style="float: right;">
</div>
<div style="color: purple;text-align: center;font-size:21px">
{{x.title}}
</div><br>
<div>
{{x.text}}
</div>
<b>
URL:-
</b>
<a href="{{x.url}}" style=" color: blue;"> To see in details, click here! </a><br> <br>
</div>
</div>
</div>
</div>
我正在新闻feed模块上工作。我有两个div,在第一个div(左侧)显示所有新闻标题的列表,并在右侧div显示有关该标题的描述和图像。但是我不能在左侧div(title-div)上添加垂直滚动条,如果我应用div,那么它只适用于每个特定的标题。第二个是页面加载时第一个标题,描述会自动加载,这两件事怎么做呢?
添加包装。
溢出滚动到所有tittle
,因为title
类在ng-repeat
中,因此在每个单独的标题中重复。
在ng-repeat
之外添加另一个包装器div并对其应用溢出滚动
<div class="wrapper">
<div ng-show = "dataFromRest" ng-repeat = "x in dataFromRest.posts" >
<div class="tittle" style="width: 25%;">
<a href="" ng-click="showDiv = ! showDiv" style="text-decoration: none;" ># {{x.title}} </a>
<a href="" style="text-decoration: none;" ng-if="!x.title"># No title</a>
<hr style="color: red">
</a>
</b>
</div>
<div class="text">
<div style="width: 70% ;float:right; background-color: white;">
<div ng-show="showDiv">
<div style="float: right;">
<img id="currentPhoto" src="{{x.thread.main_image}}" onerror="this.src='noimageavailable.png'" width="300px" height="250px" style="float: right;">
</div>
<div style="color: purple;text-align: center;font-size:21px">
{{x.title}}
</div><br>
<div>
{{x.text}}
</div>
<b>
URL:-
</b>
<a href="{{x.url}}" style=" color: blue;"> To see in details, click here! </a><br> <br>
</div>
</div>
</div>
</div>
</div><!-- .wrapper -->
并添加overflow:scroll
到包装器
.wrapper {
overflow:scroll;
}
注意,这将同时为标题和文本创建滚动。因为它们在一个包装中。如果您想要不同的,则必须使用两个不同的ng-repeat创建两个不同的包装器。
相关文章:
- 正在添加'X'按钮,在文本字段旁边使用javascript
- 如何在映射数组中添加换行符
- 正在将数据主题添加到所有项目
- ZeroClipboard-在复制之前添加到值
- 我可以在json对象中添加一个函数吗
- 将输入字段中的文本提交到我的数据库,同时将其添加到我的列表中
- 基于用户垂直滚动向HTML表添加行
- 如何在d3js垂直分组条形图中添加工具提示
- D3 垂直条形图为标签文本添加换行符
- JQuery - 在垂直滚动上添加/删除类不起作用
- 如何或在哪里将javascript settimeout函数添加到CSS垂直下拉菜单
- 如何添加固定垂直轴的焦点+上下文缩放时间序列
- 如何继续在我的页面上添加/显示项目,同时滚动垂直栏
- 为d3-2way-tree添加水平和垂直滚动条,用于多层树
- 无法在html中添加垂直滚动条
- 垂直添加JavaScript数组
- 当连续添加文本时,垂直滚动条如何保持在底部?
- 如何添加垂直滚动到Windows 8应用程序在抓拍视图
- 如何添加隐藏延迟到完整的CSS下拉垂直菜单
- 如何在矩形中添加垂直平行线