Here's the current code: (ns ^:figwheel-hooks simple-server.core (:require…
- User
Here's the current code:
(ns ^:figwheel-hooks simple-server.core (:require [clojure.string :as str] [ajax.core :refer [GET]] [goog.dom :as gdom] [goog.events :as events] [goog.history.EventType :as HistoryEventType] [reagent.core :as r :refer [atom]] [reagent.dom :as rdom] [reitit.core :as reitit]) (:import goog.History))
(def guess-val (r/atom 5)) (defn slider-on-change-handler [js-event] (reset! guess-val (-> js-event .-target .-value))) (defonce app-state (atom {:text "Guess the number I'm thinking of!"}))
(defn get-app-element [] (gdom/getElement "app"))
(defn hello-world [] [:div [:h1 "Guessing Game"] [:h3 (:text @app-state)] [:div {:class "slidecontainer"} [:input {:type "range" :id "MyRange1" :min 1 :max 10 :value 5 :on-change slider-on-change-handler}]] [:h3 @guess-val]])
(defn mount [el] (rdom/render [hello-world] el))
(defn mount-app-element [] (when-let [el (get-app-element)] (mount el)))
;; conditionally start your application based on the presence of an "app" element (mount-app-element)
;; specify reload hook with ^:after-load metadata (defn ^:after-load on-reload [] (mount-app-element) ;; (swap! app-state update-in [:__figwheel_counter] inc) )
The issues it has are:
- I want the number to be in-line with the slider.
- The slider currently doesn't move, although the value gets updated.
- Assistant
To address the issues mentioned, we'll need to make some changes to your code:
-
To ensure that the number is displayed in-line with the slider, you can adjust the HTML structure or styles to modify the layout. You can achieve this by using CSS Flexbox or inline-block display style, for instance.
-