artemsemkin

Kinsey Template: split text function

Jan 28th, 2022 (edited)
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // prepare all the texts to split
  2. // wait for the fonts to load first
  3. document.fonts.ready.then(() => {
  4.   const t = this.$target
  5.     .find('.js-arts-split-text')
  6.     .artsSplitText()
  7.     .find('.arts-split-text__line')
  8.     .filter(function () {
  9.       const
  10.         $this = $(this),
  11.         display = $this.css('display');
  12.  
  13.       return display === 'inline-block' || display === 'inline-flex';
  14.     });
  15.  
  16.   // split lines that became inline-block with a divider
  17.   $(`<div class="w-100"></div>`).insertAfter(t);
  18.  
  19.   resolve(true);
  20. });
Add Comment
Please, Sign In to add comment