PageRenderTime 48ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/assets/bower_components/jcrop/demos/tutorial4.html

https://gitlab.com/VoroninNick/radok
HTML | 227 lines | 200 code | 27 blank | 0 comment | 0 complexity | 9dd20ce3e4d87fc12955f14dc076faf6 MD5 | raw file
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Animations + Transitions | Jcrop Demo</title>
  5. <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
  6. <script src="../js/jquery.min.js"></script>
  7. <script src="../js/jquery.Jcrop.js"></script>
  8. <script src="../js/jquery.color.js"></script>
  9. <script type="text/javascript">
  10. jQuery(function($){
  11. var jcrop_api;
  12. $('#target').Jcrop({
  13. bgFade: true,
  14. bgOpacity: .2,
  15. setSelect: [ 60, 70, 540, 330 ]
  16. },function(){
  17. jcrop_api = this;
  18. });
  19. $('#fadetog').change(function(){
  20. jcrop_api.setOptions({
  21. bgFade: this.checked
  22. });
  23. }).attr('checked','checked');
  24. $('#shadetog').change(function(){
  25. if (this.checked) $('#shadetxt').slideDown();
  26. else $('#shadetxt').slideUp();
  27. jcrop_api.setOptions({
  28. shade: this.checked
  29. });
  30. }).attr('checked',false);
  31. // Define page sections
  32. var sections = {
  33. bgc_buttons: 'Change bgColor',
  34. bgo_buttons: 'Change bgOpacity',
  35. anim_buttons: 'Animate Selection'
  36. };
  37. // Define animation buttons
  38. var ac = {
  39. anim1: [217,122,382,284],
  40. anim2: [20,20,580,380],
  41. anim3: [24,24,176,376],
  42. anim4: [347,165,550,355],
  43. anim5: [136,55,472,183]
  44. };
  45. // Define bgOpacity buttons
  46. var bgo = {
  47. Low: .2,
  48. Mid: .5,
  49. High: .8,
  50. Full: 1
  51. };
  52. // Define bgColor buttons
  53. var bgc = {
  54. R: '#900',
  55. B: '#4BB6F0',
  56. Y: '#F0B207',
  57. G: '#46B81C',
  58. W: 'white',
  59. K: 'black'
  60. };
  61. // Create fieldset targets for buttons
  62. for(i in sections)
  63. insertSection(i,sections[i]);
  64. function create_btn(c) {
  65. var $o = $('<button />').addClass('btn btn-small');
  66. if (c) $o.append(c);
  67. return $o;
  68. }
  69. var a_count = 1;
  70. // Create animation buttons
  71. for(i in ac) {
  72. $('#anim_buttons .btn-group')
  73. .append(
  74. create_btn(a_count++).click(animHandler(ac[i])),
  75. ' '
  76. );
  77. }
  78. $('#anim_buttons .btn-group').append(
  79. create_btn('Bye!').click(function(e){
  80. $(e.target).addClass('active');
  81. jcrop_api.animateTo(
  82. [300,200,300,200],
  83. function(){
  84. this.release();
  85. $(e.target).closest('.btn-group').find('.active').removeClass('active');
  86. }
  87. );
  88. return false;
  89. })
  90. );
  91. // Create bgOpacity buttons
  92. for(i in bgo) {
  93. $('#bgo_buttons .btn-group').append(
  94. create_btn(i).click(setoptHandler('bgOpacity',bgo[i])),
  95. ' '
  96. );
  97. }
  98. // Create bgColor buttons
  99. for(i in bgc) {
  100. $('#bgc_buttons .btn-group').append(
  101. create_btn(i).css({
  102. background: bgc[i],
  103. color: ((i == 'K') || (i == 'R'))?'white':'black'
  104. }).click(setoptHandler('bgColor',bgc[i])), ' '
  105. );
  106. }
  107. // Function to insert named sections into interface
  108. function insertSection(k,v) {
  109. $('#interface').prepend(
  110. $('<fieldset></fieldset>').attr('id',k).append(
  111. $('<legend></legend>').append(v),
  112. '<div class="btn-toolbar"><div class="btn-group"></div></div>'
  113. )
  114. );
  115. };
  116. // Handler for option-setting buttons
  117. function setoptHandler(k,v) {
  118. return function(e) {
  119. $(e.target).closest('.btn-group').find('.active').removeClass('active');
  120. $(e.target).addClass('active');
  121. var opt = { };
  122. opt[k] = v;
  123. jcrop_api.setOptions(opt);
  124. return false;
  125. };
  126. };
  127. // Handler for animation buttons
  128. function animHandler(v) {
  129. return function(e) {
  130. $(e.target).addClass('active');
  131. jcrop_api.animateTo(v,function(){
  132. $(e.target).closest('.btn-group').find('.active').removeClass('active');
  133. });
  134. return false;
  135. };
  136. };
  137. $('#bgo_buttons .btn:first,#bgc_buttons .btn:last').addClass('active');
  138. $('#interface').show();
  139. });
  140. </script>
  141. <link rel="stylesheet" href="demo_files/main.css" type="text/css" />
  142. <link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
  143. <link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
  144. <link rel="stylesheet" href="../css/jquery.Jcrop.extras.css" type="text/css" />
  145. </head>
  146. <body>
  147. <div class="container">
  148. <div class="row">
  149. <div class="span12">
  150. <div class="jc-demo-box">
  151. <div class="page-header">
  152. <ul class="breadcrumb first">
  153. <li><a href="../index.html">Jcrop</a> <span class="divider">/</span></li>
  154. <li><a href="../index.html">Demos</a> <span class="divider">/</span></li>
  155. <li class="active">Animations + Transitions</li>
  156. </ul>
  157. <h1>Animations + Transitions</h1>
  158. </div>
  159. <div class="row-fluid">
  160. <div class="span9">
  161. <img src="demo_files/sago.jpg" id="target" alt="Jcrop Image" />
  162. <div class="description">
  163. <p id="shadetxt" style="display:none; color:#900;">
  164. <b>Experimental shader active.</b>
  165. Jcrop now includes a shading mode that facilitates building
  166. better transparent Jcrop instances. The experimental shader is less
  167. robust than Jcrop's default shading method and should only be
  168. used if you require this functionality.
  169. </p>
  170. <p>
  171. <b>Animation/Transitions.</b>
  172. Demonstration of animateTo API method and transitions for bgColor
  173. and bgOpacity options. Color fading requires inclusion of John Resig's
  174. jQuery <a href="http://plugins.jquery.com/project/color">Color
  175. Animations</a> plugin. If it is not included, colors will not fade.
  176. </p>
  177. </div>
  178. </div>
  179. <div class="span3" id="interface">
  180. <label class="checkbox">
  181. <input type="checkbox" id="fadetog" /> Enable fading (bgFade: true)
  182. </label>
  183. <label class="checkbox">
  184. <input type="checkbox" id="shadetog" /> Use experimental shader (shade: true)
  185. </label>
  186. </div>
  187. </div>
  188. <div class="tapmodo-footer">
  189. <a href="http://tapmodo.com" class="tapmodo-logo segment">tapmodo.com</a>
  190. <div class="segment"><b>&copy; 2008-2013 Tapmodo Interactive LLC</b><br />
  191. Jcrop is free software released under <a href="../MIT-LICENSE.txt">MIT License</a>
  192. </div>
  193. </div>
  194. <div class="clearfix"></div>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. </body>
  200. </html>