CSS first transition doesn’t work
-
Hi, I’m not sure what I’m doing wrong, I Would like to open a popup window with a half-second transition, and it works fine except for the first time.
here is the CSS code:
#popup-win{ display: none; opacity: 0; position: absolute; width: auto; height: auto; max-width: 300px; background: #ffffff; border: 1px solid #cccccc; padding: 10px ; overflow: hidden; z-index: 10; -webkit-box-shadow: 0px 0px 7px -1px rgba(8,74,124,1); -moz-box-shadow: 0px 0px 7px -1px rgba(8,74,124,1); box-shadow: 0px 0px 7px -1px rgba(8,74,124,1); -webkit-transition: opacity .5s ease-in-out; transition: opacity .5s ease-in-out; }
and here is the Javascript code:
var button = document.quesrySelector('#button'); var win = document.quesrySelector('#popup-win'); button.addEventListener('click', function(){ win.style.display = 'block'; win.style.opacity = '1'; });
does anyone have any idea why?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘CSS first transition doesn’t work’ is closed to new replies.