styling.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>CSS Styling Example | 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 api;
  12. $('#target').Jcrop({
  13. // start off with jcrop-light class
  14. bgOpacity: 0.5,
  15. bgColor: 'white',
  16. addClass: 'jcrop-light'
  17. },function(){
  18. api = this;
  19. api.setSelect([130,65,130+350,65+285]);
  20. api.setOptions({ bgFade: true });
  21. api.ui.selection.addClass('jcrop-selection');
  22. });
  23. $('#buttonbar').on('click','button',function(e){
  24. var $t = $(this), $g = $t.closest('.btn-group');
  25. $g.find('button.active').removeClass('active');
  26. $t.addClass('active');
  27. $g.find('[data-setclass]').each(function(){
  28. var $th = $(this), c = $th.data('setclass'),
  29. a = $th.hasClass('active');
  30. if (a) {
  31. api.ui.holder.addClass(c);
  32. switch(c){
  33. case 'jcrop-light':
  34. api.setOptions({ bgColor: 'white', bgOpacity: 0.5 });
  35. break;
  36. case 'jcrop-dark':
  37. api.setOptions({ bgColor: 'black', bgOpacity: 0.4 });
  38. break;
  39. case 'jcrop-normal':
  40. api.setOptions({
  41. bgColor: $.Jcrop.defaults.bgColor,
  42. bgOpacity: $.Jcrop.defaults.bgOpacity
  43. });
  44. break;
  45. }
  46. }
  47. else api.ui.holder.removeClass(c);
  48. });
  49. });
  50. });
  51. </script>
  52. <link rel="stylesheet" href="demo_files/main.css" type="text/css" />
  53. <link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
  54. <link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
  55. </head>
  56. <body>
  57. <div class="container">
  58. <div class="row">
  59. <div class="span12">
  60. <div class="jc-demo-box">
  61. <div class="page-header">
  62. <ul class="breadcrumb first">
  63. <li><a href="../index.html">Jcrop</a> <span class="divider">/</span></li>
  64. <li><a href="../index.html">Demos</a> <span class="divider">/</span></li>
  65. <li class="active">CSS Styling Example</li>
  66. </ul>
  67. <h1>CSS Styling Example</h1>
  68. </div>
  69. <img src="demo_files/sago.jpg" id="target" alt="[Jcrop Example]" />
  70. <div style="margin-top:1em; width:500px;">
  71. <fieldset>
  72. <legend>Manipulate classes</legend>
  73. <div class="btn-group" id="buttonbar">
  74. <button id="radio1" data-setclass="jcrop-light" class="btn active" />jcrop-light</button>
  75. <button id="radio2" data-setclass="jcrop-dark" class="btn" />jcrop-dark</button>
  76. <button id="radio3" data-setclass="jcrop-normal" class="btn" />normal</button>
  77. </div>
  78. </fieldset>
  79. </div>
  80. <p>
  81. <b>Example styling tricks.</b> Click the buttons above to change the appearance of Jcrop in real-time.
  82. </p>
  83. <div class="tapmodo-footer">
  84. <a href="http://tapmodo.com" class="tapmodo-logo segment">tapmodo.com</a>
  85. <div class="segment"><b>&copy; 2008-2013 Tapmodo Interactive LLC</b><br />
  86. Jcrop is free software released under <a href="../MIT-LICENSE.txt">MIT License</a>
  87. </div>
  88. </div>
  89. <div class="clearfix"></div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </body>
  95. </html>