Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Tickets</title>
  4. <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
  5. <!-- <link rel="stylesheet" type="text/css" href="fluidgrid.css"> -->
  6. <link rel="icon" type="image/png" href="favicon.png">
  7. <style type="text/css">
  8. body, section, label, select, input {
  9. margin:0;
  10. padding:0;
  11. }
  12.  
  13. label, select, input[type='text'] {
  14. margin:0 auto;
  15. display:block;
  16. }
  17.  
  18. label {
  19. text-align:center;
  20. font-size:2em;
  21. width:60%;
  22. }
  23.  
  24. select {
  25. text-align:center;
  26. font-size:3em;
  27. max-width:80px;
  28. }
  29.  
  30. input[type='text'] {
  31. font-size:3em;
  32. width:50%;
  33. }
  34.  
  35. body {
  36. font-family: 'Helvetica Neue', Helvetica, Arial, Sans-Serif;
  37. color:#2379DB;
  38. background-color:#EDEDED;
  39. }
  40.  
  41. section#controls {
  42. overflow:hidden;
  43. }
  44.  
  45. section#controls div {
  46. width:33.33%;
  47. padding:5px 0;
  48. }
  49.  
  50. section#controls > form > div {
  51. float:left;
  52. }
  53.  
  54. section#controls > form > div:last-child {
  55. float:right;
  56. }
  57.  
  58. div#grid {
  59. width:85%;
  60. margin:0 auto;
  61. }
  62.  
  63. div.box {
  64. /* width:19%;
  65. height:150px;*/
  66. background-color:dimgrey;
  67. border:1px solid white;
  68. float:left;
  69. }
  70.  
  71. div.row {
  72. clear:both;
  73. }
  74.  
  75. div {
  76. transition: all 1s;
  77. }
  78.  
  79. div.activated {
  80. background-color:#EDEDED;
  81. }
  82.  
  83. div.hide {
  84. display:none;
  85. }
  86.  
  87. </style>
  88. </head>
  89. <body>
  90. <section id='controls'>
  91. <form name='controlsForm' action='' method='post'>
  92. <div>
  93. <label for='gridHeight'>Height</label>
  94. <select name='gridHeight'></select>
  95. </div>
  96. <div>
  97. <label for='gridWidth'>Width</label>
  98. <select name='gridWidth'></select>
  99. </div>
  100. <div>
  101. <label for='animSpeed'>Speed (ms)</label>
  102. <input name='animSpeed' type='text'/>
  103. </div>
  104. </form>
  105. </section> <!-- #controls -->
  106. <section id='gridArea'>
  107. <div id='grid'>
  108. </div>
  109. </section>
  110. <!-- <script type='text/javascript' src='fluidgrid.js'></script> -->
  111. <script type='text/javascript' src='mn.js'></script>
  112. </body>
  113. </html>
  114.  
  115. (function() {
  116. var FluidGrid = {
  117. $heightSelect: null,
  118. $widthSelect: null,
  119. $selects: null,
  120. $grid: null,
  121. $gridElements: null,
  122.  
  123. settings: {
  124. maxElements: 10,
  125. height: 1,
  126. width: 1,
  127. speed: 0
  128. },
  129.  
  130. // box: {
  131.  
  132. // },
  133.  
  134. // addElements: function(amount, axis) {
  135.  
  136. // },
  137.  
  138. // removeElements: function() {
  139.  
  140. // },
  141.  
  142. // changeHeight: function(oldHeight) {
  143. // if(oldHeight < FluidGrid.settings.height) {
  144. // //old < new
  145. // } else {
  146. // //new > old
  147. // }
  148. // },
  149.  
  150. // changeWidth: function(oldWidth) {
  151.  
  152. // },
  153.  
  154. modifyGrid: function(amount, axis) {
  155. var oldHeight,
  156. oldWidth;
  157.  
  158. if(axis === 'gridHeight') {
  159. oldHeight = FluidGrid.settings.height;
  160. FluidGrid.settings.height = amount;
  161.  
  162. } else {
  163. oldWidth = FluidGrid.settings.width;
  164. FluidGrid.settings.width = amount;
  165. }
  166. },
  167.  
  168. populateSelect: function(inSelect) {
  169. inSelect.empty();
  170. for(var index = 1; index <= FluidGrid.settings.maxElements; index++) {
  171. inSelect.append(
  172. $('<option>').text(index)
  173. );
  174. }
  175. },
  176.  
  177. init: function(config) {
  178. var fg = FluidGrid;
  179. // Initialize variables
  180. $heightSelect = $('form > div:first-child > select');
  181. $widthSelect = $('form > div:nth-child(2) > select');
  182. $selects = $('select');
  183. $grid = $('#grid');
  184.  
  185. // Initialize and populate the array containing
  186. // grid elements
  187. $gridElements = $([]);
  188.  
  189.  
  190. // Dynamically populate the <select>s with numbers.
  191. fg.populateSelect($selects);
  192.  
  193. // e.target.value is the value of the select.
  194. // this.name is the name of the select.
  195. $('select').on('change', function(e) {
  196. fg.modifyGrid(e.target.value, this.name);
  197. });
  198.  
  199. // Generate the elements
  200. for(var height = 0; height < fg.settings.maxElements; height++) {
  201. $gridElements.push([]);
  202. $tempUl = $('<div>').addClass('row');
  203. $grid.append($tempUl);
  204.  
  205. for(var width = 0; width < fg.settings.maxElements; width++) {
  206. $newDiv = $('<div>').addClass('box');//.attr('id',height + '-' + width);
  207. $gridElements[height].push($newDiv);
  208. $tempUl.append($newDiv);
  209. }
  210. }
  211.  
  212. //TESTING
  213. $('div.box').on('click', function() {
  214. var tempBox = $(this);
  215. tempBox.addClass('activated');
  216. setTimeout(function() {
  217. tempBox.removeClass('activated');
  218. }, 1000);
  219. })
  220.  
  221. tempWidth = (($('.row').eq(0).width() / fg.settings.maxElements) - 5) + 'px';
  222.  
  223. $('div.box').css({'width':tempWidth, 'height':tempWidth});
  224. }
  225. };
  226.  
  227. FluidGrid.init({
  228.  
  229. });
  230. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement