2db47680
hexiaodong
chore: 初始提交 php 遗...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/**
* Created by chenyihong on 14/12/4.
*/
KindEditor.plugin('fixtoolbar', function (K) {
var self = this;
if (!self.fixToolBar) {
return;
}
function init() {
var toolbar = K('.ke-toolbar');
var originY = toolbar.pos().y;
K(window).bind('scroll', function () {
if (toolbar.css('position') == 'fixed') {
if(document.body.scrollTop - originY < 0){
toolbar.css('position', 'static');
toolbar.css('top', 'auto');
}
} else {
if (toolbar.pos().y - document.body.scrollTop < 0) {
toolbar.css('position', 'fixed');
toolbar.css('top', 0);
}
}
});
}
if (self.isCreated) {
init();
} else {
self.afterCreate(init);
}
});
|