GithubHelp home page GithubHelp logo

Comments (7)

jstayton avatar jstayton commented on August 15, 2024

Hey Vlad,

That is a very cool effect. I think you can achieve it as well without too much effort.

If you're not using autocomplete (Marco Polo), adding focusin and focusout event callbacks on div.mf_container — after you've initialized Manifest on the input — makes it easy to add and remove the class:

$('#input').manifest('container')
  .focusin(function () {
    $(this).addClass('mf_focused');
  })
  .focusout(function () {
    $(this).removeClass('mf_focused');
  });

If you're using Marco Polo, however, the input blurs and gains focus again whenever a result is selected by mouse, which will likely cause an unwanted flicker effect. I do keep track of what I call "pseudo-focus" within the code, however, so it shouldn't be too difficult to provide hooks into those events. (I do already provide a onFocus callback, but no onBlur.)

Let me know what you think. Thanks!

Justin

from jquery-manifest.

callmevlad avatar callmevlad commented on August 15, 2024

Hey Justin,

Ah, I didn't notice the onFocus callback. I am using Marco Polo, so I'm going to play around a bit to see if I can get around the flicker you mentioned.

Thanks again,
Vlad

from jquery-manifest.

jstayton avatar jstayton commented on August 15, 2024

Cool. Let me know how it works out. I'll close this for now, but feel free to continue replying here.

Justin

from jquery-manifest.

jstayton avatar jstayton commented on August 15, 2024

Hey Vlad,

I've added an onBlur event callback in v1.5.0 of Marco Polo, which is bundled with the latest version of Manifest (v1.2.1). That may work better to hook into for what you're trying to do.

Justin

from jquery-manifest.

callmevlad avatar callmevlad commented on August 15, 2024

Justin,

Holy cow, how did I miss your comment??? I ended up playing around on my own, but taking a look at your changeset it looks much cleaner - I'm going to give it a shot and let you know how it goes. Thanks!!!

Vlad

from jquery-manifest.

callmevlad avatar callmevlad commented on August 15, 2024

Justin,

Thanks very much for the new version of Marco Polo - it worked like a charm. Looks like the focus/blur tracking is spot on, and the control I ended up creating (preview here: http://i.imgur.com/qKZX9.png) focuses naturally as if it were a regular text input field. Thanks again!

Vlad

from jquery-manifest.

jstayton avatar jstayton commented on August 15, 2024

Awesome! Looks great!

Justin

from jquery-manifest.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.