Jump to content
Search Community

nemmoj

Members
  • Posts

    7
  • Joined

  • Last visited

Community Answers

  1. nemmoj's post in WordPress, jQuery and TweenMax text animation workaround was marked as the answer   
    Hi everyone, 
     
    Thanks for your time and effort being spent here. Today I`ve solved this isse.
     
    The bone was burried in type of jQuery function, .replace()  method and  RegEx.
     
    Initially, in my playground I had this:
    var $demoText = $("#gsap-anim-text-1"); $demoText.html( $demoText.html().replace(/./g, "<span>$&</span>").replace(/\s/g, " ")); So my class="article-meta" (...WP core generated php text classified by my blog theme stylesheet, and predefined in content.php) was followed by manually added variable #id  ( id="gsap-anim-text-1" ). Thus my post excerpt (class="article-meta") was animated by TweenMax in an odd way with this function (with markup characters being visible, and belive me... that was not .css issue ) .
     
     
    As a solution, I've  changed jQuery function to :
     
    $demoText.each(function(){ $(this).html($(this).text().replace(/./g, "<span>$&</span>").replace(/\s/g, " ")); }); I think it lets RegEx  /./g  expression cooperate with jQuery's .replace() in a better way. 
     
    p.s. - jQuery v.1.12.2 was used in my WP 4.3.3 playground.
    p.p.s. - I've left the issue in my playground untouched, for everyone to see the issue (markup being visible during animation) and try this code as a solution. Worked for me.
     
    Thanks.
×
×
  • Create New...