Add check for container-element

This commit is contained in:
Vitaliy Vlasov 2018-01-26 12:46:50 +02:00
parent dbffabffe0
commit 3813e19150
1 changed files with 4 additions and 2 deletions

View File

@ -45,7 +45,8 @@
{:class "grayed-out-page-num"
:on-click #(do
(rf/dispatch [:set-page-number i])
(.scrollIntoView @container-element))})
(when @container-element
(.scrollIntoView @container-element)))})
i])
max-page-nums 6]
[:div.page-nums-container
@ -97,7 +98,8 @@
(if forward?
(inc page-number)
(dec page-number))])
(.scrollIntoView @container-element)))
(when @container-element
(.scrollIntoView @container-element))))
draw-rect (fn [direction]
(let [forward? (= direction :forward)
gray-out? (or (and forward? (= page-number page-count))