document.getElementById("myDiv").style.marginTop = "50px";
window.onscroll = function() { document.getElementById('id').style.margin = '40px 0 0 0' }