add function for slider