I'm making a snake game. I'm trying to make the player turn so the body elements of it should follow the head and should be created after it's head.

```
<!--Player-->
<div class="snake"></div>

```

Ok. This is the snake and the game is throwing all of the parts inside. Head and body parts.

```
      var pos = 100;
//Snake Grows

    var grow = function() {
        $('<div></div>').addClass('body').prependTo('.snake').css('left', pos * score * 1.1 +'%');
    }

```

This function is called later when snake eats the food. It creates a block that prepends to the snake's body but when it turns it just goes vertically. Is there a follow() function or something simmilar that will make the body parts go through same path as the head? If not any ideas how to solve this? I'm new to programing so any advices would be helpful.