November 05, 2014
[caption id="" align=“alignnone” width=“822.0”] Making some magic with Waypoints today.How
The code
element.waypoint handler : (direction) -> return if direction isnt ‘down’ element.addClass ‘in-view’ context : attrs.waypoint offset : ‘95%’ triggerOnce : true
The style
.container overflow: hidden opacity: 0 transition: opacity .25s ease-in-out .left transform: translate3d(-100%, 0, 0) .right transform: translate3d(100%, 0, 0) &.in-view opacity: 1 .left, .right transform: translate3d(0, 0, 0) transition: transform .25s ease-in-out
The waypoint plugin (in this case, activated by an Angular directive) is adding a class to the container, which causes a transition of the transform on the items, as well as the opacity of the container. Smooth as butter. [/caption]
Hey, I'm Ian. I build websites and write about what I learn as I go. Follow me on Twitter.