Q:

how to add or remove class to horizontal scrollbar?

i am trying to add a back to top button on a horizontal scrolling page.
but i am unable to add or remove the class. 
so that i can show or hide the add to top button.
i am trying with the folloing js
`
$(window).scroll(function() {    
    var scroll = $(window).scrollTop();
     //console.log(scroll);
    if (scrollX >= 50) {
        //console.log('a');
        $(".btt").addClass("show");
    } else {
        //console.log('a');
        $(".btt").removeClass("hide");
    }
});

`
what should i do??
Thank You

A:

You should be doing
if (scrollX >= 50) {
    // Add show and remove hide
    $(".btt").addClass("show").removeClass("hide");
} else {
    //Add hide and remove show
    $(".btt").addClass("hide").removeClass("show");
}

