UNPKG

tram

Version:

Cross-browser CSS3 transitions in JavaScript

47 lines (41 loc) 1.28 kB
<!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>tram.js example</title> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <link rel="stylesheet" href="../support/styles/example.css"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="../node_modules/jquery/dist/jquery.min.js"><\/script>')</script> <script src="../dist/tram.js"></script> </head> <style type="text/css"> .test { -webkit-transition: all 2s, background-color 0; -o-transition: all 2s, background-color 0; transition: all 2s, background-color 0; transition: all 2s, background-color 0; } .test2 { -webkit-transition: none 0s ease 0s; -o-transition: none 0s ease 0s; transition: none 0s ease 0s; transition: none 0s ease 0s; } </style> <body> <p> Inherit transitions from existing CSS styles. </p> <div class="test"></div> <div class="test test2"></div> <script> tram.config.keepInherited = true; var test = $('.test'); tram(test) .add('background 300ms') .start({ background: '#57889D' }); </script> </body> </html>