index.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <!DOCTYPE html>
  2. <html lang="en-gb" data-ng-app="elasticDemo" id="ng-app">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Angular Elastic</title>
  6. <meta name="viewport" content="width=device-width">
  7. <link rel="stylesheet" href="//necolas.github.io/normalize.css/2.1.1/normalize.css">
  8. <style>
  9. html {
  10. background: #e7f3ff;
  11. color: #1c000e;
  12. text-shadow: 0 1px 0 #fff;
  13. }
  14. body {
  15. margin: 8px auto;
  16. max-width: 90%;
  17. width: 480px;
  18. }
  19. h1 {
  20. margin: 0 0 8px;
  21. font-weight: normal;
  22. font-size: 30px;
  23. }
  24. a {
  25. color: #0074e7;
  26. text-decoration: none;
  27. -webkit-transition: all 250ms ease-in-out;
  28. -moz-transition: all 250ms ease-in-out;
  29. -o-transition: all 250ms ease-in-out;
  30. transition: all 250ms ease-in-out;
  31. }
  32. a:hover,
  33. a:focus,
  34. a:active {
  35. color: #0067ce;
  36. -webkit-transition: none;
  37. -moz-transition: none;
  38. -o-transition: none;
  39. transition: none;
  40. }
  41. textarea {
  42. padding: 10px;
  43. width: 300px;
  44. max-width: 90%;
  45. }
  46. .animate:focus {
  47. -webkit-transition: height 50ms ease-in-out;
  48. -moz-transition: height 50ms ease-in-out;
  49. -o-transition: height 50ms ease-in-out;
  50. transition: height 50ms ease-in-out;
  51. }
  52. #first {
  53. font-size: 30px;
  54. }
  55. </style>
  56. </head>
  57. <body data-ng-controller="elasticDemoController">
  58. <h1>Angular Elastic</h1>
  59. <form data-ng-submit="submit()">
  60. <p>
  61. <textarea class="msd-elastic" data-ng-model="foo" id="first" data-ng-show="show" ng-init="show = true" data-ng-controller="elasticCallbackController"></textarea>
  62. </p>
  63. <small data-ng-show="show"><a href data-ng-click="show = false">Hide</a> | </small>
  64. <small data-ng-show="!show"><a href data-ng-click="show = true">Show</a> | </small>
  65. <small><a href data-ng-click="foo = 'Model changed'">Change model</a></small>
  66. <p>
  67. <textarea class="animate msd-elastic: \n;" data-ng-model="bar"></textarea>
  68. </p>
  69. <p>
  70. <input type="submit" value="Submit and reset">
  71. </p>
  72. </form>
  73. <small>
  74. <a href="https://github.com/monospaced/angular-elastic">https://github.com/monospaced/angular-elastic</a> <br>
  75. <a href="http://monospaced.github.io/">Monospaced Labs</a>
  76. </small>
  77. <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
  78. <script src="elastic.js"></script>
  79. <script>
  80. angular.module('elasticDemo', ['monospaced.elastic'])
  81. .controller('elasticDemoController', ['$scope', '$log', function($scope, $log){
  82. 'use strict';
  83. $scope.foo = 'This textarea is going to grow when you fill it with text. Just type a few more words in it and you will see. This textarea is going to grow when you fill it with text.';
  84. $scope.bar = 'Elastic with a CSS transition. Try typing something...';
  85. $scope.submit = function(){
  86. $scope.bar = '';
  87. };
  88. }])
  89. .controller('elasticCallbackController', ['$scope', '$log', function($scope, $log){
  90. 'use strict';
  91. $scope.$on('elastic:resize', function(){
  92. $log.log('Height was adjusted!');
  93. });
  94. }]);
  95. </script>
  96. </body>
  97. </html>