Learning, cleaning up and updating a snippet I found on-line. I've been adding the somewhat new code "use strict";
and the way the snippet has been programmed is alike the below snippet;
81| document.addEventListener("mouseup", function() {
82| "use strict";
83| if (!dragging) return;
84| $scrollbar.css('z-index', dragging.z_idx);
85| $scrollbar.removeClass('active-scroll');
86| dragging = null;
87| }, true);
Line 83 is pulling up the following error;
Expected "{" and instead saw "return".
I know how to bracket this section however I'm not sure how the return
is doing exactly, whether I should ass the {
before the return and then close up after dragging = null;
?
This is also used as seen below;
91| dragTarget.addEventListener("mousemove", function(e) {
92| "use strict";
93| if (!dragging) return;
94|
95| $scrollbar.offset({
96| top:limit(e.clientY - dragging.pos_y, dragging.drg_h)
97| });
98| update_scroll();
99| }, true);