Fix slider range and bug on toggleOpacity function