pivot.js

A vanilla JavaScript library for creating a AppleTV-esque 3D hover effect using CSS3 transforms.

The effect has been optimised for 60fps in compatible browsers, and compatibility extends to early versions of Chrome, Firefox and Safari with vendor prefixes.

Reliable IE support probably limited to IE11 and above, though IE10 should technically be covered as CSS3 3D transforms first landed in IE10.

Configuration is not necessary beyond the CSS selector(s), but almost every aspect of the effect can be customised from the configuration object.

Live examples

Here are some live examples of how the affected elements work depending on the configuration options passed in:

pivot({
  selector: "#one"
});
pivot({
  selector: "#two",
  perspective: 500
});
pivot({
  selector: "#three",
  sensitivity: 10
});
pivot({
  selector: "#four",
  invert: true
});
pivot({
  selector: "#five",
  scale: true
});
pivot({
  selector: "#six",
  shadow: true
});
pivot({
  selector: "#seven",
  shine: true
});
pivot({
  selector: "#eight",
  persist: true
});
pivot({
  selector: "#ten",
  position:
  {
    method: "absolute",
    zindex: 5
  }
});
pivot({
  selector: "#ten",
  transition:
  {
    prop: "transform,
    background-color",
    duration:"0.5s",
    timing:[0.4,1,0.3,1]
  }
});
pivot({
  selector: "#eleven",
  hoverInClass: "hover-in"
});
pivot({
  selector: "#twelve",
  hoverOutClass: "hover-out"
});
pivot({
  selector: "#thirteen",
  hoverClass: "hovering"
});
Touch support automatically activates on supported devices

Get Started

    	   <script src="https://cdn.rawgit.com/wnda/pivot/master/pivot.js"></script>
    	   <script>pivot({ selector: ".your-selector", ... });</script>