I’m trying to generate a random location for a Marker on a google map. I have successfully managed to add the users latitude to a random number using parseFloat (when I simply + them it didnt work…).
However, I use the exact same code to parse the users longitude with a random number, and nothing happens.
E.g:
Latitude = 49.0291
Longitude = -0.9912
Both of these numbers are added to a number generated by (Math.floor(Math.random() * 300)/1000)
The latitude is randomly generated, and the marker moves accordingly. However, when I try to move that same marker vertically, nothing happens (despite the fact that the value does actually change!).
I have attached a JS FIDDLE of my code.
All help is greatly appreciated, thank you.
Instead of jamming a bunch of code into one line, I split it out and got it to work:
http://jsfiddle.net/UmCNZ/
Nesting functions in code is bad.