Definitely put IDs on your elements, and wait until the page is loaded/ready (window.onload vs $(document).ready())
Are you only trying to alter the x-position of your elements? You should be able to set a JS function that listens for the page to be ready and then just kick off your animation, whether in CSS or JS.
1
solved From left/right to center transition with buttons [closed]