beforeSlideChange method added