the same as http://codepen.io/yevt/pen/jdyAB but used modernizr coffee scss
Created
August 1, 2015 06:00
-
-
Save anonymous/a7243b0bfb604c35091a to your computer and use it in GitHub Desktop.
Which Transition Event (Modernizr)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="subject"> | |
| div#subject | |
| <input type="button" value="fade to red" id="fadeToRed"> | |
| <input type="button" value="fade to green" id="fadeToGreen"> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #listen transitions | |
| transEndEventNames = | |
| 'WebkitTransition' : 'webkitTransitionEnd', | |
| 'MozTransition' : 'transitionend', | |
| 'OTransition' : 'oTransitionEnd otransitionend', | |
| 'msTransition' : 'MSTransitionEnd', | |
| 'transition' : 'transitionend' | |
| transEndEventName = transEndEventNames[Modernizr.prefixed 'transition']; | |
| subject = document.getElementById 'subject' | |
| subject.addEventListener transEndEventName, () -> | |
| alert('transition end'); | |
| , false | |
| #listen buttons | |
| document.getElementById('fadeToGreen').addEventListener 'click', () -> | |
| subject.className = 'green'; | |
| document.getElementById('fadeToRed').addEventListener 'click', () -> | |
| subject.className = 'red'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @import "compass/css3"; | |
| @import 'compass'; | |
| div { | |
| margin: 100px; | |
| padding: 20px; | |
| background: grey; | |
| } | |
| .red { | |
| background-color: red; | |
| @include transition(background-color 1s); | |
| } | |
| .green { | |
| background-color: green; | |
| @include transition(background-color 1s); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment