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

Highlight feature #7

Closed
amit777 opened this issue Jun 14, 2015 · 1 comment
Closed

Highlight feature #7

amit777 opened this issue Jun 14, 2015 · 1 comment

Comments

@amit777
Copy link

amit777 commented Jun 14, 2015

Would it be possible to have a highlight-then-delete feature for the word that is typed? Hubspot.com has this. The effect makes it looks like someone is highlighting the word that was typed and then deleting it.

@yuanqing
Copy link
Owner

You can use the call method. The code might look something like:

var m = malarkey(elem, opts);

[ 'foo', 
  'bar', 
  'baz' 
].forEach(function(str) {
  m.type(str)
   .call(function(elem) {
     elem.classList.add('highlighted');
     this();
   })
   .pause()
   .delete()
   .call(function(elem) {
     elem.classList.remove('highlighted');
     this();
   })
   .pause();
});

Some simple CSS animations or transitions on the .highlighted class should give the desired highlighting effect.

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

2 participants