Created
December 7, 2018 15:48
-
-
Save Leocardoso94/7ea466405d6f458fae4f240bbd3eaebe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns scroll-reveal | |
| (:require | |
| ["scrollreveal" :as scroll-reveal])) | |
| (defonce sr (scroll-reveal)) | |
| (defn reveal | |
| [element options] | |
| (.reveal sr element (clj->js options))) | |
| ;; inside a component | |
| (defn component | |
| [] | |
| (let [!refs (atom {:foo nil})] | |
| (r/create-class | |
| {:component-did-mount | |
| (fn [] | |
| (scroll-reveal/reveal (:foo @!refs) {:origin "left" | |
| :distance "500px" | |
| :duration 1000}) | |
| :reagent-render | |
| (fn [] | |
| [:div.w-50 | |
| {:ref (fn [com] | |
| (swap! !refs assoc :foo com)) | |
| :style {:visibility "hidden"}} | |
| [:p "234"]]))}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment