element.style.margin-top code example
Example 1: modify margin top javascript
window.onscroll = function() { document.getElementById('id').style.margin = '40px 0 0 0' }
Example 2: css margin top
.yourClass {
margin-top: 25px;
}
window.onscroll = function() { document.getElementById('id').style.margin = '40px 0 0 0' }
.yourClass {
margin-top: 25px;
}