Looking at an incomplete code example, it is very difficult to determine what is happening, so please either update your question with the full code, or better, download JSFiddle to serve as an example, and we can directly update it with the necessary changes. So far (based on what I said earlier), it looks like you get the effect flickeringdue to typos in your code example :
? nav.css({ 'position': 'fixed',
'z-index': z_index,
top: y,
left: x, })
: nav.css({ 'position': 'static', });
CSS, ( ,), CSS '. :
? nav.css({ 'position': 'fixed',
'z-index': z_index,
'top': y,
'left': x })
: nav.css({ 'position': 'static' });
, z_index, y x.
: JSFiddle -. , , , , , , , . , JSFiddle, . , , . , . , - ( ).;)