javascript - CSS Transition Does Not Fire onbeforeunload -


i have nutty client who'd large css transition on every page unload on site.

this fiddle works intended delay, easing, , duration: http://jsfiddle.net/klw4c/

however when try implement exact same (i think) code here: http://nolaflash.com/transition.html transition not occur.

page code follows. why work in fiddle , not in page?

<!doctype html> <html> <head> <meta charset="utf-8">  <script type="text/javascript">//<![cdata[      window.onload=function(){         window.onbeforeunload = function (e) {             document.getelementbyid('mylink').classname = 'out';         }     }//]]> </script>  <style type="text/css"> #mylink {     display:block;     padding:20px;     background:#ccc;     transition-property: background color;     transition-duration: 12.5s;     transition-timing-function: ease;     transition-delay: 6.5s; } #mylink.out {     background:#cc0000; } </style> </head>  <body id="bod" class='in'>  <a href='https://www.google.com' id='mylink'>click me , watch me go red before page unloads</a>  </body> </html> 

beforeunload supposed used prompt.

according spec, if page is unloaded "salvageable" flag set false, cause preventing transition.

see: http://dev.w3.org/html5/spec-lc/history.html#unloading-documents


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -