File tree Expand file tree Collapse file tree 2 files changed +17
-41
lines changed Expand file tree Collapse file tree 2 files changed +17
-41
lines changed Original file line number Diff line number Diff line change 20
20
21
21
/* 目录栏的样式 */
22
22
.div_toc {
23
- width : 90% ;
23
+ width : -webkit-calc (100% - 10px );
24
+ height : 100% ;
24
25
float : left;
25
- /* */
26
- /*
27
26
padding : 20px ;
28
- border-radius: 3px;
29
- width: 400px;
30
- height: 85%;
31
- min-height: 200px;
32
- z-index: 999;
33
- left: 10px;
34
- top: 70px;
35
- bottom: 20px;
36
- overflow-x: hidden;
37
27
overflow : auto;
28
+ overflow-x : hidden;
38
29
background-color : # fafbfc ;
39
30
border : 1px solid # d1d5da ;
40
- float: right; */
41
- /* width: 400px;
42
- min-height: 200px;
43
- z-index: 999;
44
- background-color: #fafbfc;
45
- border: 1px solid #d1d5da;
46
- overflow-x: hidden;
47
- left: 10px;
48
- top: 70px;
49
- border-radius: 3px;
50
- overflow: auto;
51
- height: 85%;
52
- bottom: 100px;
53
- float: left; */
54
- /* cursor: e-resize; */
31
+
55
32
}
56
33
57
34
.div_right_bar {
58
- width : 10px ; background : red; cursor : e-resize; float : left;
35
+ width : 10px ;
36
+ height : 100% ;
37
+ background-color : white;
38
+ cursor : e-resize;
39
+ float : left;
59
40
}
60
41
61
42
.toc {
62
43
position : fixed;
63
44
width : 400px ;
64
45
min-height : 200px ;
65
46
z-index : 999 ;
66
- background-color : # fafbfc ;
67
- border : 1px solid # d1d5da ;
68
- padding : 20px ;
69
- overflow-x : hidden;
47
+
70
48
left : 10px ;
71
49
top : 70px ;
72
50
border-radius : 3px ;
73
- overflow : auto;
74
51
height : 85% ;
75
52
bottom : 100px ;
76
53
float : left;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ function init(list) {
39
39
var div_right_bar = document . createElement ( "div" ) ; // 这是一个 拖动bar
40
40
div_right_bar . setAttribute ( 'id' , "div_right_bar" ) ;
41
41
div_right_bar . setAttribute ( "class" , "div_right_bar" ) ;
42
- div_right_bar . textContent = "bar " ;
42
+ div_right_bar . textContent = "" ;
43
43
44
44
45
45
@@ -86,18 +86,16 @@ function init(list) {
86
86
return toc ;
87
87
}
88
88
89
+
89
90
// 这里是绑定resize事件的方法
90
91
function bindResize ( el ) {
91
92
//初始化参数
92
93
var els = document . getElementById ( 'toc' ) . style ;
93
-
94
94
//鼠标的 X 和 Y 轴坐标
95
95
x = 0 ;
96
-
97
96
//邪恶的食指
98
97
el . onmousedown = function ( e ) {
99
98
//按下元素后,计算当前鼠标与对象计算后的坐标
100
-
101
99
x = e . clientX - el . offsetWidth ,
102
100
y = e . clientY - el . offsetHeight ;
103
101
console . log ( x ) ;
@@ -125,6 +123,10 @@ function bindResize(el) {
125
123
function mouseMove ( e ) {
126
124
//宇宙超级无敌运算中...
127
125
els . width = e . clientX - x + 'px' ;
126
+ els . width = e . clientX - 10 + 'px' ;
127
+ console . log ( "clientX:" + e . clientX ) ;
128
+ console . log ( "x:" + x ) ;
129
+
128
130
}
129
131
//停止事件
130
132
function mouseUp ( ) {
@@ -138,10 +140,7 @@ function bindResize(el) {
138
140
function ( ) {
139
141
document . removeEventListener ( "mousemove" , mouseMove ) ;
140
142
document . removeEventListener ( "mouseup" , mouseUp ) ;
141
- } ( )
142
- //卸载事件
143
- // 这里也需要改写,你帮我看下啊。这样对吗?1
144
-
143
+ } ( )
145
144
) ;
146
145
}
147
146
}
You can’t perform that action at this time.
0 commit comments