The error is that _this.offset is not a function. I logged this to the console and it was the element I clicked on, so I am confused why
Replace these two lines:
var topx = _this.offset().top;
var leftx = _this.offset().left;
with:
var topx = _this.offsetTop;
var leftx = _this.offsetLeft;
As .offset() is a jquery function and _this is a DOM element.
Also for your .css line you have to wrap _this in $(...) again because _this is a DOM element and **not a jQuery object.