The problem is happening because you are comparing strings, not numbers.
Here's the function that you're running.
Where within toggleZoom imgCSS is the style of the image.
When you check (imgCSS < wPre) where wPre is the string value '164', the script is comparing two strings to see if "82px" is less than "164". Since 8 is less than 1, it's true that in terms of string value, "82px" is less than "164"
You should instead extract the number from the CSS style, and supply the function with numbers instead of strings.
toggleZoom('img-stepper', 82, 164, 125, 250);
if (Number(imgCSS.width.replace('px', '')) < wPre) would end up comparing two numbers.