Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.57 KB | None | 0 0
  1. var observer = new MutationObserver(function(mutations) {
  2. mutations.forEach(function(mutationRecord) {
  3.     // if style has changed add your margin class
  4.     $('nav').classList.toggle('your-margin');
  5.    });    
  6.  });
  7.  
  8. // Get our target element which in this case is the nav
  9. var target = document.getElementById('nav');
  10. // 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
  11. observer.observe(target, { attributes : true, attributeFilter : ['style'] });
  12.  
  13.  
  14.  
  15. your-margin{
  16. margin-top: 58px;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement