Giter VIP home page Giter VIP logo

hover-video-player's Issues

Multiple hover play and paused

Hello @Gyanreyer,

Thank you for this library :)

I'm trying to do something but I can't do it with your doc.

I would like to put play and paused each time a link is hovered over a class for example.

But I have the impression that this does not work :

const player = document.querySelector("hover-video-player");

        $(".site-navigation li.page_item").each(function () {
            $(this).on("mouseenter", function () {
                player.playbackState = "play";
            })
            $(this).on("mouseenter", function () {
                player.playbackState = "paused";
            })
        });

I only have this that works:

hover-target=""

But in the end it is not practical if you want to hover over several links. I don't have any additional IDs on my hrefs.

Thanks for your return

Now working in combination with barba.js

I am using WP for one of my projects and barba.js to make it SPA-like.

Plugin is working fine without barba.js and on first page load, however it doesn't work when navigating through pages (using barba) and I can't find any functions to be used to reinit/reload elements.

I tried setting manual hoverTarget which triggers on each page load, but this also works only on first load:

const players = document.querySelectorAll("hover-video-player");
players.forEach((player) => {
  console.log("set hover target", player);
  player.hoverTarget = document.querySelectorAll(".some-hover-target");
});

Output in log is exactly the same for first load and on each page load (through barba), but hover effect is not working.

Is there function I can call to reinit/reload plugin?

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.