MCPcopy Create free account
hub / github.com/TruthHun/BookStack / previewBindScroll

Function previewBindScroll

static/editor.md/editormd.js:1751–1775  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1749 };
1750
1751 var previewBindScroll = function() {
1752
1753 preview.bind(mouseOrTouch("scroll", "touchmove"), function(event) {
1754 var height = $(this).height();
1755 var scrollTop = $(this).scrollTop();
1756 var percent = (scrollTop / $(this)[0].scrollHeight);
1757 var codeView = codeMirror.find(".CodeMirror-scroll");
1758
1759 if(scrollTop === 0)
1760 {
1761 codeView.scrollTop(0);
1762 }
1763 else if (scrollTop + height >= $(this)[0].scrollHeight)
1764 {
1765 codeView.scrollTop(codeView[0].scrollHeight);
1766 }
1767 else
1768 {
1769 codeView.scrollTop(codeView[0].scrollHeight * percent);
1770 }
1771
1772 $.proxy(settings.onpreviewscroll, _this)(event);
1773 });
1774
1775 };
1776
1777 var previewUnbindScroll = function() {
1778 preview.unbind(mouseOrTouch("scroll", "touchmove"));

Callers

nothing calls this directly

Calls 1

$Function · 0.50

Tested by

no test coverage detected