CASE statement Afterwards applied, although the order of the code is different (fade-out/fade-in onClick button event)

Just google “image src flickering” and you’ll find many discussions re the issue.