mirror of
https://github.com/doocs/md.git
synced 2024-11-25 03:18:36 +08:00
清除jquery库
This commit is contained in:
parent
56d961d9fa
commit
775dffe995
@ -202,26 +202,23 @@ export default {
|
|||||||
// 左右栏同步滚动
|
// 左右栏同步滚动
|
||||||
leftAndRightScroll() {
|
leftAndRightScroll() {
|
||||||
const _this = this;
|
const _this = this;
|
||||||
|
const previewRef = document.getElementById('preview');
|
||||||
|
|
||||||
document.getElementById('preview').addEventListener("scroll", function callback() {
|
previewRef.addEventListener("scroll", function callback() {
|
||||||
clearTimeout(_this.timeout)
|
clearTimeout(_this.timeout)
|
||||||
|
|
||||||
let source = $(_this)
|
let source = this
|
||||||
let target = $(source.is('#preview') ? 'div.CodeMirror-scroll' : '#preview')
|
let target = this.id === 'preview' ? document.getElementsByClassName('CodeMirror-scroll')[0] : previewRef;
|
||||||
|
|
||||||
target.off('scroll')
|
target.removeEventListener("scroll", callback, false);
|
||||||
|
let percentage = source.scrollTop / (source.scrollHeight - source.offsetHeight)
|
||||||
|
let height = percentage * (target.scrollHeight - target.offsetHeight)
|
||||||
|
target.scrollTo(0, height)
|
||||||
|
|
||||||
let source0 = source[0]
|
_this.timeout = setTimeout(()=> {
|
||||||
let target0 = target[0]
|
target.addEventListener("scroll", callback, false);
|
||||||
|
}, 300)
|
||||||
let percentage = source0.scrollTop / (source0.scrollHeight - source0.offsetHeight)
|
}, false);
|
||||||
let height = percentage * (target0.scrollHeight - target0.offsetHeight)
|
|
||||||
target0.scrollTo(0, height)
|
|
||||||
|
|
||||||
_this.timeout = setTimeout(() => {
|
|
||||||
target.on('scroll', callback)
|
|
||||||
}, 100)
|
|
||||||
}, true);
|
|
||||||
},
|
},
|
||||||
onEditorRefresh() {
|
onEditorRefresh() {
|
||||||
this.editorRefresh();
|
this.editorRefresh();
|
||||||
@ -236,7 +233,7 @@ export default {
|
|||||||
'editorRefresh', 'initCssEditorEntity'])
|
'editorRefresh', 'initCssEditorEntity'])
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.leftAndRightScroll()
|
this.leftAndRightScroll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user