quantumbutterfly quantumbutterfly - 1 year ago 75
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
property is 50%. How can I do this?

Answer Source

Nevermind I figured it out.

Solution was to put "50%" in quotes

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download