Gallery not showing when content is hidden at first

Hi
I made some simple html/css tabs using check box and tab content is showing only when its checkbox is checked while others are by default set to display:none;

Each tab contains a gallery but they are not showing when I click on other tabs, i.e. only active/checked tab is showing gallery.
See the video for demonstration in this link: https://sarenko.dameno.net/gallery-problem.mp4

Btw, galleries that are not shown in tabs work just fine outside of tabs so I assume there is some problem when the content is set to display:none;.
Any idea how to sole this issue?

Replies are visible only to logged in members with an active subscription.