add toogle slider function and test code