UNPKG

tram

Version:

Cross-browser CSS3 transitions in JavaScript

47 lines (40 loc) 1.42 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> <body> <p> This demo was flickering / jumping in Desktop Safari, until UA sniffs were added. See ticket: <a href="https://github.com/BKWLD/tram/issues/2">https://github.com/BKWLD/tram/issues/2</a> </p> <div class="test"></div> <div class="test"></div> <div class="test"></div> <script> var $el = $('.test'); tram($el) .add('opacity 1s ease') .add('background 1s ease 500') .add('transform 500ms ease') .set({ opacity: 0 }) .start({ opacity: 1, background: '#FF374E', x: 100, y: 100 }) .then({ x: 200, y: 200, rotate: 90 }) .then(function (t) { console.log('almost...'); t.add('transform 0.3 ease-out-expo') t.next() }) .then({ x: 0, y: 0, rotate: 90 }) .then(function (t) { console.log('done!'); }); </script> </body> </html>