change margin javascript code example
Example 1: modify margin top javascript
window.onscroll = function() { document.getElementById('id').style.margin = '40px 0 0 0' }
Example 2: js add margin with variable
var players = document.getElementsByClassName('player');
for(var i = 0; i < players.length; i++)
players[i].style.marginTop = playerPosition+"px";