Set active class by visibility