Advertisement
Guest User

Sketch Project

a guest
Dec 20th, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.49 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.    
  4.     <head>
  5.          
  6.         <meta charset="utf-8" />
  7.         <meta name="format-detection" content="telephone=no" />
  8.         <meta name="msapplication-tap-highlight" content="no" />
  9.         <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
  10.         <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
  11.        
  12.         <title>SketchPad</title>
  13.        
  14.         <style>
  15.            
  16.             .centre {
  17.                 margin: 5px auto;
  18.                 width: 450px;
  19.                 text-align: center;
  20.             }
  21.              
  22.             .selectors a {
  23.                 border: 1px solid black;
  24.                 border-radius: 4px;
  25.                 height: 30px;
  26.                 line-height: 30px;
  27.                 padding: 0 10px;
  28.                 vertical-align: middle;
  29.                 text-decoration: none;
  30.                 display: inline-block;
  31.                 color: black;
  32.                 font-weight: bold;
  33.             }
  34.            
  35.             canvas {
  36.                 background: #f4f4f4;
  37.                 padding-left: 0;
  38.                 padding-right: 0;
  39.                 margin-left: auto;
  40.                 margin-right: auto;
  41.                 display: block;
  42.             }
  43.            
  44.          </style>
  45.          
  46.     </head>
  47.    
  48.     <body>
  49.          
  50.         <div id="sketchpad">
  51.              
  52.             <div class="tool selectors centre"></div>
  53.    
  54.             <canvas id="colors_sketch" width="800" height="480">Your browser does not support the HTML5 canvas tag.</canvas>
  55.            
  56.             <div class="selectors centre">
  57.                 <a href="#colors_sketch" data-tool="marker">Marker</a>
  58.                 <a href="#colors_sketch" data-tool="eraser">Eraser</a>
  59.                 <a href="" data-tool="eraser">Clear</a>
  60.             </div>
  61.            
  62.         </div>
  63.            
  64.         <script type="text/javascript" src="cordova.js"></script>
  65.         <script type="text/javascript" src="js/jquery.min.js"></script>
  66.         <script type="text/javascript" src="js/sketch.js"></script>
  67.        
  68.         <script type='text/javascript'>
  69.            
  70.             $(function() {
  71.                 $.each(['#f00', '#ff0', '#0f0', '#0ff', '#00f', '#f0f', '#000', '#fff'], function() {
  72.                     $('#sketchpad .tool').append("<a href='#colors_sketch' data-color='" + this + "' style='width: 10px; background: " + this + ";'></a> ");
  73.                 });
  74.                 $.each([3, 5, 10, 15], function() {
  75.                     $('#sketchpad .tool').append("<a href='#colors_sketch' data-size='" + this + "' style='background: #ccc'>" + this + "</a> ");
  76.                 });
  77.                 $('#colors_sketch').sketch();
  78.             });
  79.            
  80.             $(window).on("load resize",function(e){
  81.                 document.getElementById("colors_sketch").height=$(window).height()-100;
  82.                 document.getElementById("colors_sketch").width=$(window).width();
  83.             });
  84.            
  85.         </script>
  86.        
  87.     </body>
  88.    
  89. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement