Skip to content

Instantly share code, notes, and snippets.

@enricopolanski
Created February 19, 2018 12:27
Show Gist options
  • Save enricopolanski/548301c23cdaef95e4c05267427a9c1d to your computer and use it in GitHub Desktop.
Save enricopolanski/548301c23cdaef95e4c05267427a9c1d to your computer and use it in GitHub Desktop.
function clearAll(el, func){
console.log("b");
el.appendBefore(el.previousElementSibling);
el.classList.remove("transitioning");
el.nextElementSibling.style.position = "static";
el.nextElementSibling.removeEventListener("mousemove", func);
}
function elementTransition(element, distX, func){
document.styleSheets[0].insertRule(".transitioning{ transition: transform 300ms linear;"+
"transform: translate(" + distX + "px, 0px);}");
element.classList.add("transitioning");
console.log("a")
window.setTimeout( clearAll(element, func), 300);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment