Jump to content
Search Community

keeping the focus when using Flip on an input

Alex Jester

Go to solution Solved by GreenSock,

Recommended Posts

Alex Jester
Posted (edited)

Hello,

I am trying to animate an input element using Flip for when the user is typing something, but when Flip is called my input is loosing the focus.

I tried calling a onComplete: function() { input.focus() }, but that doesn't work...

See the Pen KKQWOdV by jester6 (@jester6) on CodePen.

Edited by Alex Jester
I added a codepen example of what I am trying to achieve
  • Solution
Posted

Thanks for providing a minimal demo! I wish everyone did such a great job of boiling the question down and including a succinct demo. 

 

You're doing a bunch of extra work on every key press that really isn't necessary - here's how I'd do it: 

See the Pen poaPzgp?editors=0010 by GreenSock (@GreenSock) on CodePen.

 

Does that work better for you? 

  • Like 1
  • Thanks 1
Alex Jester
Posted

Now I understand it :)

It works perfectly!

It's already live, obviously the final version is more stylish here with the search field Intreb BT - Banca Transilvania

Thank you so much!

  • Like 2
Posted

What a nice effect! Thanks for sharing Alex!

  • Thanks 1
Alex Jester
Posted

Thank you!

I'm happy to be using GSAP :)

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...