Here’s a quick drag-and-drop business model canvas using JQuery. It’s intended for use on a large screen in place of a whiteboard with sticky notes. I haven’t finished the “save” functionality yet. It could also do with some optimization as I jumpstarted the code by linking to a full copy of bootstrap and jqueryui.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jQuery UI - Business Model Canvas 2.0</title> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous"> <style> body { padding:10px; } .col-sm { border:1px solid #000; } h3 { font-size:1em; } .stickynote { width:100px; height:100px; padding:.5em; float:left; margin:1px; overflow:scroll; position: relative; cursor:grab; } .delete { position:absolute; top:0; left:5px; font-size:.7em; color:red; cursor: pointer; visibility:hidden; } .target { width:100%; height:100%; padding:.5em; background:#eee; } .target .stickynote:hover .delete { visibility:visible; } textarea { background:transparent; width:100%; resize:none; min-width:100%; min-height:100%; outline:0!important; border:0; } #trash { width:100px; height:100px; bottom:0; background:#ddd; font-size:.8em; float:left; visibility:hidden; } </style> </head> <body> <div class="container-fluid"> <div class="row"> <div class="col-sm-1"> <div class="col-sm-2"> <div id="note-holder ui-widget ui-widget-shadow"> <div class="stickynote ui-state-highlight draggable connectedSortable"> <span class="delete">x</span> <p></p> </div> </div> <div id="trash" class="target">Trash</div> </div> </div> <div class="col-sm-11"> <div class="container-fluid"> <div class="row"> <div class="col-sm-12"> <div class="xcontainer"> <div class="row" style="height: 600px;"> <div class="col-sm target"> <h3>Key Partners</h3> </div> <div class="col-sm" style="padding: 0;"> <div class="target" style="height:50%; border-bottom: 1px solid black;"> <h3>Key Activities</h3> </div> <div class="target" style="height:50%;"> <h3>Key Resources</h3> </div> </div> <div class="col-sm target"> <h3>Value Propositions</h3> </div> <div class="col-sm target"> <h3>Customer Relationships</h3> </div> <div class="col-sm target"> <h3>Value Propositions</h3> </div> </div> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <div class="row" style="height: 300px;"> <div class="col-sm target"> <h3>Cost Structure</h3> </div> </div> </div> <div class="col-sm-6"> <div class="row" style="height: 300px;"> <div class="col-sm target"> <h3>Revenue Streams</h3> </div> </div> </div> </div> </div> </div> </div> </div> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $( function() { $( ".stickynote" ).draggable({ connectToSortable: ".target", helper: "clone", start: function( event, ui ) { $( this ).css("position", "relative"); }, stop: function( event, ui ) { $( this ).css("left", "0").css("top", "0"); } }); $( ".target" ).sortable({ items: "> .stickynote", placeholder: "ui-state-highlight", connectWith: ".target", start: function( event, ui ) { $( "#trash" ).css("visibility", "visible"); }, stop: function( event, ui ) { $( "#trash" ).css("visibility", "hidden"); } }); $(".target").on("dblclick", ".stickynote", noteClicked); $(".target").on("mouseover", ".stickynote", makeResizable); $("#trash").droppable({ drop: function(event, ui) { $( ui.draggable ).remove(); } }); $(".target").on("click", ".delete", deleteNote); }); function noteClicked() { var divHtml = $(this).find('p').html(); var editableText = $("<textarea />"); editableText.val(divHtml); $(this).find('p').replaceWith(editableText); editableText.focus(); editableText.blur(editableTextBlurred); } function editableTextBlurred() { var html = $(this).val(); var viewableText = $("<p>"); viewableText.html(html); $(this).replaceWith(viewableText); viewableText.click(noteClicked); } function makeResizable() { $(this).resizable({ containment: "parent", autoHide: true }) } function deleteNote() { $(this).parent().remove(); } </script> </body> </html> |
1 Comment
Add Yours →Wow Couzin Jem-impressive programmer still! You are so talented brightest blessings to you and your code ttfn S