Advertisement
loggerer

set container alignment

May 27th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       function setContainerAlignment(alignment) {
  2.         let x = '';
  3.         let y = '';
  4.         if (alignment.includes('top')) {
  5.           y = 'flex-start';
  6.         } else if (alignment.includes('bottom')) {
  7.           y = 'flex-end';
  8.         } else {
  9.           y = 'center';
  10.         }
  11.         if (alignment.includes('left')) {
  12.           x = 'flex-start';
  13.         } else if (alignment.includes('right')) {
  14.           x = 'flex-end';
  15.         } else {
  16.           x = 'center';
  17.         }
  18.         return {'justify-content': x, 'align-items': y}
  19.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement