getelementbyid and apply margin code example
Example: modify margin top javascript
window.onscroll = function() { document.getElementById('id').style.margin = '40px 0 0 0' }
window.onscroll = function() { document.getElementById('id').style.margin = '40px 0 0 0' }