Start autoplaying gifs only on hover or tap
This commit is contained in:
parent
aea0c8f1f1
commit
33ebd5eb2a
1 changed files with 6 additions and 3 deletions
|
|
@ -358,9 +358,12 @@
|
|||
"video" [:video {:controls true}
|
||||
[:source {:type (str "video/" ext) :src remote-url}]
|
||||
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]
|
||||
"gifv" [:video {:loop true :autoplay true :muted true}
|
||||
"gifv" (let [autoplay (r/atom false)
|
||||
toggle-autoplay #(swap! autoplay not)]
|
||||
(fn []
|
||||
[:video {:loop true :autoplay @autoplay :muted true :on-pointer-enter toggle-autoplay}
|
||||
[:source {:type (str "video/" ext) :src remote-url}]
|
||||
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]
|
||||
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]))
|
||||
[:div [:strong "Unsupported attachment"]
|
||||
[debug attachment]])))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue