Home Reference Source

src/fixModalShifting/index.js

  1. import { addStyles, hasScrollBar } from '../utilities';
  2.  
  3. function addStyleToFixModalShifting() {
  4. if (hasScrollBar()) {
  5. addStyles(`
  6. body.modal-open {
  7. padding-right: 15px;
  8. }
  9.  
  10. // Fix fixed header jump to right issues
  11. body.modal-open nav.affix {
  12. right: 15px;
  13. }
  14. `);
  15. }
  16. }
  17.  
  18. /**
  19. * Fix bootstrap modal's shifting issue.
  20. * Run bse.fixModalShifting.init();
  21. * @example
  22. * bse.fixModalShifting.init();
  23. */
  24. export function init() {
  25. addStyleToFixModalShifting();
  26. }
  27.  
  28. export function update() {}