Skip to content

Feature idea: Controlled by another element #87

@LukeTOBrien

Description

@LukeTOBrien

Hello there,

I like your script very much and I had an idea of a feature to add.
What if I wanted the prevent the element from tilting on mouse over but rather have the element tilt when I move the mouse another element?
If you included a controller option then I could set the controller to the selector of another div, this way I could also control many tilt elements with the same controller.
Something like:

VanillaTilt.init(document.querySelector(".your-element"), {
  controller: '#controller-div'
});

Or HTML:

<div class="your-element" data-tilt data-tilt-controller="#controller-div"></div>
<div id="controller-div"></div>

You could even have a custom (or manual) API like so:

VanillaTilt.init(document.querySelector(".your-element"), {
  controller: 'custom'
});
element.vanillaTilt.tilt({
  x: 100,
  y: 100
});

This would make it possible to keep a counter variable and tilt the element inside a setInterval for eg.

What do you think of this idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions