I am using smooth scrollbar (https://github.com/idiotWu/smooth-scrollbar/blob/develop/dist/smooth-scrollbar.js) and have implemented this. On Chrome it works okay-ish. Firefox says "SyntaxError: bad method definition main.js 5:8", what am I doing wrong? Totally stuck
Live example: https://saraleszczynska.pl
The code (main.js)
var Scrollbar = window.Scrollbar;
class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin
{
static ScrollbarPluginginName = 'horizontalScroll';
transformDelta( delta, fromEvent )
{
if ( !/wheel/.test( fromEvent.type ) )
return delta;
const { x, y } = delta;
return {
y: 0,
x: Math.abs( x ) > Math.abs( y ) ? x : y,
};
}
}
Scrollbar.use( HorizontalScrollPlugin );
( function ( $ )
{
var scroll = Scrollbar.init( document.querySelector( '#gallery' ), {
alwaysShowTracks: true,
} );
scroll.track.yAxis.element.remove();
$( '.goto' ).on( 'click touchstart', function ( e )
{
e.preventDefault();
$( 'html, body' ).animate( {
scrollTop: $( this.hash ).offset().top,
}, 800 );
} );