【发布时间】:2015-09-27 11:25:04
【问题描述】:
我正在尝试为主要内容区域创建水平滚动。我有一个标题、侧边栏和一个 div (wrapperContent)。基本上标题和 div (wrapperContent) 应该像TeamWeek 一样水平滚动。侧边栏是固定的,只会垂直滚动
在我的 div wrapperContent 类上,我放置了一个溢出自动,它应该可以让我滚动。
基本上黄色和红色背景应该一直存在并且应该是唯一可滚动的
使用角度
这是我的 codepen 示例 -> http://codepen.io/GY22/pen/PqeoZv
hmtl 代码:
<!-- START HEADER -->
<header>
<div><h1>Timeline</h1></div>
</header>
<!-- END HEADER -->
<!-- START SIDEBAR -->
<div id="sidebar" ng-app="DragDrop" ng-controller="AppCtrl">
<ul>
<li ng-repeat="user in users" class="circular">
<p class="initials">{{user.initials}}</p>
</li>
</ul>
</div>
<!-- END SIDEBAR -->
<!-- START CONTENT -->
<div class="wrapperContent">
</div>
<!-- END CONTENT -->
css代码:
header{
width: 100%;
height:90px;
background-color: yellow ;
}
#sidebar {
position: fixed;
width: 120px;
height: 100%;
background-color: #03A9F4;
z-index: 33;
margin-top: 0px;
overflow-y: scroll;
overflow-x: hidden;
margin-bottom: 100px
}
#userList {
padding-bottom: 10px !important;
}
ul li {
margin-left: -22px;
list-style-type: none;
}
.circle {
border-radius: 50%;
width: 25px;
height: 25px;
background-color: hotpink;
}
.initials {
margin-left: 25px;
padding-top: 30px;
font-weight: bold;
font-size: 18px;
}
.wrapperContent {
width: 100%;
height: 100%;
overflow: auto;
background-color: red;
}
角码:
var contentEditor = angular.module("DragDrop", []);
contentEditor.controller('AppCtrl', function($scope) {
$scope.users = [{
initials: 'GY'
}, {
initials: 'XX'
}, {
initials: 'KK'
}, {
initials: 'TT'
}, {
initials: 'AA'
}, {
initials: 'QQ'
}, {
initials: 'PP'
}, {
initials: 'SS'
}, {
initials: 'MM'
}, {
initials: 'RS'
}, {
initials: 'KL'
}, {
initials: 'CJ'
}, {
initials: 'RT'
}, {
initials: 'DJ'
}, {
initials: 'XG'
}, {
initials: 'XX'
}];
});
【问题讨论】:
标签: javascript html css angularjs