]> git.0d.be Git - nanofun.git/commitdiff
create pads from a template, then delete the template
authorFrédéric Péters <fpeters@0d.be>
Wed, 22 Feb 2017 17:34:36 +0000 (18:34 +0100)
committerFrédéric Péters <fpeters@0d.be>
Sat, 1 Apr 2017 10:37:19 +0000 (12:37 +0200)
This works around a margin bug that made the first element have a
slightly larger right margin.

index.html
nanofun.js

index 9c92333984fb65faeaed5b15958b40bf53d5b8af..fad9fb295b8aa583f1dbf6670cefd6062eb54376 100644 (file)
@@ -11,7 +11,7 @@
  </head>
  <body>
   <div id="nanopad">
-   <div class="nanotouch" data-touch="0">
+   <div class="nanotouch">
      <span class="name"></span>
      <span class="duration"></span>
      <input type="file" accept="audio/*" multiple>
index 34e1dcc2184a1f675f4092afac24778c9776cccf..3fd7203ae2a86a4c8bf013364d71b9258e72edc6 100644 (file)
@@ -333,11 +333,12 @@ var nanofun = function() {
   self.initUI = function() {
     var $nanopad = $('#nanopad');
     var $nanotouch = $('.nanotouch');
-    for (var i=1; i<16; i++) {
+    for (var i=0; i<16; i++) {
       var $new_touch = $nanotouch.clone();
       $new_touch.attr('data-touch', i);
       $new_touch.appendTo($nanopad);
     }
+    $nanotouch.remove(); /* remove template */
 
     $('.nanotouch input[type=file]').on('change', function(ev) {
       var sample_idx = parseInt($(this).parent().data('touch'));