quantumbutterfly quantumbutterfly - 3 days ago 6
CSS Question

Velocityjs giving syntax error when css "left" parameter is a percentage

This works:

Velocity(document.getElementsByClassName('center')[0], { left:50 }, { duration: 1000 });


This doesn't:

Velocity(document.getElementsByClassName('center')[0], { left:50% }, { duration: 1000 });


With this I get
Uncaught SyntaxError: Unexpected token }


I need to animate this such that the css
left
property is 50%. How can I do this?

Answer

Nevermind I figured it out.

Solution was to put "50%" in quotes

Comments