-
-
Save crankyadmin/8a569d73a26d670fd2ab89c04b7da3c1 to your computer and use it in GitHub Desktop.
ClojureScript function to show a Bootstrap dropdown.
This file contains 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
(defn actions [array-of-funcs] | |
(doseq [func array-of-funcs] (func))) |
This file contains 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
(defn show-dropdown [e] | |
(this-as button | |
(let [$button (js/$ button)] | |
(.preventDefault e) | |
(remove-dropdown) | |
(.addClass (.parents $button ".dropdown") "open")))) |
This file contains 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
(defn show-dropdown [e] | |
(this-as button | |
(let [$button (js/$ button)] | |
(actions | |
(array (fn [] (.preventDefault e)) | |
(fn [] (remove-dropdown)) | |
(fn [] (.addClass (.parents $button ".dropdown") "open"))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment