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

Generate Hover effect onclick #36

Open
n3d1m opened this issue Mar 4, 2021 · 2 comments
Open

Generate Hover effect onclick #36

n3d1m opened this issue Mar 4, 2021 · 2 comments

Comments

@n3d1m
Copy link

n3d1m commented Mar 4, 2021

Is it possible to generate the hover effect whenever a button is clicked? I am trying to build an image slider that uses this effect to transition between images

@Agent2222
Copy link

Add parameter hover : 'false' , then add .next() or .previous() to the function on a click event.

@al-amiir
Copy link

let next = document.querySelector(".singleProduct__next");
let prev = document.querySelector(".singleProduct__prev");

let x = new hoverEffect({
  parent: document.querySelector(".singleProduct__left-image"),
  intensity: 0.3,
  image1: "../pix/products/rings/ring-1.jpg",
  image2: "../pix/products/rings/ring.jpg",
  hover: false,
  displacementImage: "../pix/products/fluid.jpg",
});

next.addEventListener("click", () => {
  x.next();
});

prev.addEventListener("click", () => {
  x.previous();
});

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

3 participants