refactoring off canvas effect