jQuery-slimScroll icon indicating copy to clipboard operation
jQuery-slimScroll copied to clipboard

Uncaught ReferenceError: t is not defined

Open maxcc0 opened this issue 8 years ago • 3 comments

I get the error when I drag the scrollbar. I looked into it a bit, here's the problem:

    if (o.railDraggable){
      bar.bind("mousedown", function(e) {
        var $doc = $(document);
        isDragg = true;
        _t = parseFloat(bar.css('top'));_
        _pageY = e.pageY;_

        $doc.bind("mousemove.slimscroll", function(e){
          _currTop = t + e.pageY - pageY;_
          bar.css('top', currTop);
          scrollContent(0, bar.position().top, false);// scroll content
        });

In the snippet above, vars t, pageY and currTop have not been defined with 'var' .

In my code 'use strict' is getting applied globally hence I'm getting the error. When I pre-prended these vars with 'var', it worked fine.

maxcc0 avatar Jul 13 '16 11:07 maxcc0

some news on this issue?

TiBianMod avatar Oct 16 '16 10:10 TiBianMod

+1 on this issue. I'm facing the same thing.

LBobirca avatar Mar 12 '17 00:03 LBobirca

If anyone faced this issue using webpack, here is a hack that solved the problem: Install a script-loader and add the next line:

require('!script!../static/js/jquery.slimscroll.min.js');

PS. this is not a recommended way of doing this, so don't ask me why I had to come up with this.

tarasmatsyk avatar May 23 '17 09:05 tarasmatsyk