Giter Site home page Giter Site logo

hover3d's Introduction

jQuery Hover3d

Bower version

jQuery Hover3d is a simple hover script for creating 3d hover effect. It was my experiment on exploring CSS3 3d transform back in 2015 on Codepen 3D hover plane effect.

The idea is transforming the element into 3d space using CSS3 transform, playing with translateZ for spacing the elements, and detecting mouse movement to change the transform value

Demo

Check out the demo

Usage

Include jQuery, and jquery.hover3d.min.js within your HTML

HTML

<script src="jquery.min.js"></script>
<script src="jquery.hover3d.min.js"></script>

There is a minimal markup required, the element container and element that will be transformed into 3d card

<div class="project">
	<div class="project__card">
		<!-- Content element goes here -->
	</div>
</div>

CSS

There is no special CSS file to be included, you can write your own CSS and playing with transform on child elements. However there is helper class that will be added when hovering in and out.

/* This class can be replaced using options */
.hover-in{
	transition: .3s ease-out;
}
.hover-out{
	transition: .3s ease-in;
}

JS

Next step is init the plugin on .project and give the selector element that will be transformed, in this case it's project__card.

$(".project").hover3d({
	selector: ".project__card"
});

Options

Option Type Default Description
selector string null Selector for element that will be the 3d card
perspective integer 1000 Perspective value for 3d space
sensitivity integer 20 Mouse movement sensitivity, larger number is less sensitive
invert boolean false Default behavior is the element will follow the mouse, look like it facing the mouse
shine boolean false Add shining layer
hoverInClass string hover-in Helper class when mouse hover in the element, will be removed after 300ms
hoverOutClass string hover-out Helper class when mouse hover Out the element, will be removed after 300ms
hoverClass string hover-3d Helper class when the mouse is hovering the element

Compatibility

All browser that support 3d transform and perspective. You can check it on caniuse.com

hover3d's People

Contributors

roma-so avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hover3d's Issues

touch event

hi
may i use touchEventListener in future? thank you guys

Multiple elements

Is it possible to get this working out the box with multiple elements without multiple instances? It seems that when called, on hover of one element, it applies the hover to all elements at the same time.

Full screen visibility on a 5k imac

I am having the problem when i add the shine to the banner.
When i hover this a couple of times it giving me stripes on my screen.

I have the latest version of "hover3d".
In the attachment is a screenshot of how it looks.

The pink squire is the point where it breaks.

schermafbeelding 2017-02-20 om 14 21 58

Odd behavior in Safari

This plugin is great! Definitely makes the screen pop. However, I've noticed some odd behavior in Safari. It seems project__cards are being overlayed by the element used to create the shine effect.

screen shot 2017-07-13 at 9 30 40 am

Jitter Bug

Hi, im using chrome.

when i hover over the element i have made the card, the hover isnt smooth, it jitters really bad. is there something that can cause jitters?

this is my code: ( I have the classes stated in the docs already in)
Archive.zip

JS:
$(".film_3d_wrapper").hover3d({ selector: ".film_3d", perspective: 1000, shine: false });

Its not letting me upload my html so i will attach it in a .zip

see my video:
jitterbug.zip

Support for for multiple elements without an inner wrapper

I'm finding it difficult to use this plugin for alot of cases I have in my markup for a project I'm doing.
In my html, I have some server side generated html like this....

<div class="items">
    <div class="item-to-hover">.....</div>
    <div class="item-to-hover">.....</div>
    <div class="item-to-hover">.....</div>
</div>

For layout and design reasons, I don't want an inner div on the "item-to-hover" divs. This prevents me from using this plugin because if I do the following, all of the items in "items" hover at the same time...
$(".items").hover3d({ selector: ".item-to-hover" });

I can fix this locally by editing the plugin on line 30 to be
$card = settings.selector ? $(this).find(settings.selector) : $(this);

Now I can just do the following without needing to specify a selector option
$(.item-to-hover).hover3d();

Which seems to solve my problem, but I'm wondering if there is a built in option that does this that I'm not aware of, or if this will cause an issue I haven't thought of.

Thanks

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.