Is there a lib for manipulating CSS on the client side in Clojurescript?

北城以北 提交于 2019-12-12 18:04:28

问题


I want to make new CSS rules on the client, for doing CSS transitions for example. Apparently jQuery has this kind of thing, but what about in the world of Clojurescript ?

I found Gaka and Garden for generating CSS on the server side like Hiccup, but what if I want to do dynamic CSS on the client side ?

Does Enlive, Dommy or any of those Clojurescript libs do that ?


回答1:


Take a look at jayq

You can do CSS manipulation to a DOM element via simple built in css wrapper and a Clojure map:

(ns myapp
  (:use [jayq.core :only [$ css inner]]))

(def $interface ($ :#interface))

(-> $interface
  (css {:background "blue"})
  (inner "Loading!"))



回答2:


Garden works on the client side with ClojureScript. It does virtually everything the "server side" Clojure version does with a few minor exceptions. You can use it to generate or update stylesheets in the browser if that's what you're looking for.



来源:https://stackoverflow.com/questions/16668248/is-there-a-lib-for-manipulating-css-on-the-client-side-in-clojurescript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!