Skip to content

Commit 16969ce

Browse files
authored
optimization
1 parent c872561 commit 16969ce

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

vuescroll/js/vuescroll.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@
9999
marginTop: self.sTop,
100100
right: (self.options.float == 'right' ? '0px' : ''),
101101
transition: 'opacity .5s',
102-
cursor: 'default'
102+
cursor: 'default',
103+
opacity:0
103104
},
104105
attrs: {
105106
id: self.id2
@@ -151,11 +152,9 @@
151152
this.height = Math.max(this.scrollHeight / (this.scrollInnerHeight / this.scrollHeight), this.minBarHeight);
152153
//计算滚动条每次滚动的距离innerdeltaY
153154
this.innerdeltaY = (this.scrollHeight - this.height) / scrollTime;
154-
if(this.scrollHeight < this.scrollInnerHeight){
155155
//调整top的值
156156
this.resizeTop();
157157
this.showBar();
158-
}
159158
},
160159
resizeTop: function() {
161160
//先求出con剩余的值
@@ -164,8 +163,10 @@
164163
this.top = this.scrollHeight - (this.height + (time * this.innerdeltaY));
165164
},
166165
showBar: function() {
167-
var bar = document.getElementById(this.id2);
168-
bar.style.opacity = 1;
166+
if(this.scrollHeight < this.scrollInnerHeight){
167+
var bar = document.getElementById(this.id2);
168+
bar.style.opacity = 1;
169+
}
169170
},
170171
hideBar: function() {
171172
if (!this.mousedown) {

0 commit comments

Comments
 (0)