add event handler for slider