How to translate the only one axis of the crosshair ?

I want to achieve the following effect, but i do not have lean JS langague. Can someone give me any proposes?