Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off blinking cursor at the end #13

Closed
yuehkchou opened this issue Mar 19, 2018 · 7 comments
Closed

Turn off blinking cursor at the end #13

yuehkchou opened this issue Mar 19, 2018 · 7 comments

Comments

@yuehkchou
Copy link

Hi, I am currently using the Typewriterjs for animated header.
I was wondering if there is a way to remove or in the least pause the blinking cursor once it finishes playing. Tried using the changeSetting method but that doesn't seem to work either.

Am I doing something wrong?

 var typewriter = new Typewriter(app, {
     loop: false,
     blinkSpeed: 35
 });


 typewriter.typeString('Testing Testing Testing')
     .pauseFor(3500)
     .changeSettings({ "animateCursor": false })
     .start();

Thank you in advance

@coltmans21
Copy link

+1
I just arrived to the same issue. A fix would be nice :)

@tameemsafi
Copy link
Owner

I will look into this issue, however, I am in the process of releasing a new version which is created with typescript.

@realgs
Copy link
Contributor

realgs commented Nov 17, 2018

Any news here?

@tameemsafi
Copy link
Owner

@realgs I will add this feature very soon

@realgs
Copy link
Contributor

realgs commented Nov 17, 2018

Thanks for a quick response! If only I were be able to make the changeSettings() function work it'd be easy to achieve the result just by replacing our cursor to cursor: ''. Do you have changeSettings() function? I can't see it in your project's description.

@tameemsafi
Copy link
Owner

@realgs @yuehkchou You can use the callFunction method in order to adjust the styling of the cursor when animation is complete. The first parameter will be an object containing all the elements.

Example: https://jsfiddle.net/8qeujc4s/5/

@bobrosoft
Copy link

Doing it with next workaround:

<Typewriter
  options={{
    delay: 75,
  }}
  onInit={typewriter => {
    typewriter
      .typeString(
        `First line<br/>Second line`,
      )
      .callFunction(state => {
        state.elements.cursor.setAttribute('hidden', 'hidden');
        typewriter.stop();
      })
      .start();
  }}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants