You need only to bind your element to a couple of events.
$("#slider").hover(
function(){
$(this).addClass('is-hover'); // you can use every class name you want of course
},
function(){
$(this).removeClass('is-hover');
}
);
or, in a more concise way
$("#slider").hover(
function(){
$(this).toggleClass('is-hover'); // you can use every class name you want of course
}
);
In this way every time the mouseenter
event is fired you will add a is-hover
class to your element and, when the mouseleave
event is fired, you will remove the class.
In your if statement you will have to change only:
if ( qactive == 0 && !($("#slider").hasClass('is-hover')) ) {
That's it.
Please note that you will have to adapt this example to your code, of course. Here I'm only assuming what you could need, since I can't see your code.