Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutationRecord) {
- // if style has changed add your margin class
- $('nav').classList.toggle('your-margin');
- });
- });
- // Get our target element which in this case is the nav
- var target = document.getElementById('nav');
- // Get the attibute values of the target element we would like to watch for changes in this case the styles change so watch for those changes
- observer.observe(target, { attributes : true, attributeFilter : ['style'] });
- your-margin{
- margin-top: 58px;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement