Good afternoon, I do not understand why the script does not work. help me please

https://jsfiddle.net/3xd2wto5/

$('.language__link').on('mousemove',function(e){ leftZ = 0; leftP = 50+"%"; if(this.left > 0) { $(this).css({ 'position':'absolute', 'left': leftZ }); } else { $(this).css({ 'position':'absolute', 'left': leftP }); } }); 

    1 answer 1

    1) The element has no left property, you need style.left
    2) The check is incorrect, because when you insert "50%", it will not be greater than zero.

    Try this:

     $('.language__link').on('mousemove', function(e) { leftZ = 0; leftP = "50%"; if (this.style.left != 0 && this.style.left != '0px') { $(this).css({ 'position': 'absolute', 'left': leftZ }); } else { $(this).css({ 'position': 'absolute', 'left': leftP }); } }); 
     .language__link { width: 200px; padding: 25px; border: 1px solid #000000; } 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div class="language__link"> Text </div>