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

Function previewBindScroll

static/editor.md/editormd.amd.js:1779–1803  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1777 };
1778
1779 var previewBindScroll = function() {
1780
1781 preview.bind(mouseOrTouch("scroll", "touchmove"), function(event) {
1782 var height = $(this).height();
1783 var scrollTop = $(this).scrollTop();
1784 var percent = (scrollTop / $(this)[0].scrollHeight);
1785 var codeView = codeMirror.find(".CodeMirror-scroll");
1786
1787 if(scrollTop === 0)
1788 {
1789 codeView.scrollTop(0);
1790 }
1791 else if (scrollTop + height >= $(this)[0].scrollHeight)
1792 {
1793 codeView.scrollTop(codeView[0].scrollHeight);
1794 }
1795 else
1796 {
1797 codeView.scrollTop(codeView[0].scrollHeight * percent);
1798 }
1799
1800 $.proxy(settings.onpreviewscroll, _this)(event);
1801 });
1802
1803 };
1804
1805 var previewUnbindScroll = function() {
1806 preview.unbind(mouseOrTouch("scroll", "touchmove"));

Callers

nothing calls this directly

Calls 1

$Function · 0.50

Tested by

no test coverage detected