Giter Club home page Giter Club logo

Comments (8)

hsnaydd avatar hsnaydd commented on September 3, 2024

Hi @shikkaba

You can do it by yourself.

const moveTo = new MoveTo();
const trigger = document.getElementsByClassName('js-trigger')[0];

moveTo.registerTrigger(trigger, function(target){
  trigger.blur();
  if (target instanceof HTMLElement) {
     target.focus();
  }
});

Thank you.

from moveto.

shikkaba avatar shikkaba commented on September 3, 2024

Thank you for writing this, but I'm just saying that this would be a good thing to have in the script as well.

from moveto.

hsnaydd avatar hsnaydd commented on September 3, 2024

Hi @shikkaba

Thank you for your sugesstion but, I am not sure this is a task that the plugin should do. I dont want to make this plugin complicated. I want to keep it simple and lightweight.

Thank you.

from moveto.

hackuun avatar hackuun commented on September 3, 2024

@hsnaydd by "not making it complicated" you make it even more complicated for others people to use. The code above doesn't work for me.

const moveTo = new MoveTo()
    const triggers = document.getElementsByClassName('js-trigger')
    for (var i = 0; i < triggers.length; i++) {
      moveTo.registerTrigger(triggers[i], function (target) {
        triggers[i].blur()
        if (target instanceof HTMLElement) {
          target.focus()
        }
      })
    }

Uncaught TypeError: Cannot read property 'blur' of undefined

Thank you.

from moveto.

hackuun avatar hackuun commented on September 3, 2024

Callback doesn't return an element in the loop. It return undefined or 4 (I got 4 elements). It doesn't return actual element!

from moveto.

hsnaydd avatar hsnaydd commented on September 3, 2024

Hi @iamdubx
Can you show me an example on jsfiddle ?

from moveto.

hackuun avatar hackuun commented on September 3, 2024

@hsnaydd sure, here - https://jsfiddle.net/Ltstnk0s/

from moveto.

hsnaydd avatar hsnaydd commented on September 3, 2024

Hi @iamdubx

Check this;
https://jsfiddle.net/Ltstnk0s/1/

from moveto.

Related Issues (18)

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.