SHARE
TWEET

Modernizr-Canvas-Pollyfill

a guest Aug 22nd, 2013 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.     <title>02. Canvas</title>
  5.     <script type="text/javascript" src="modernizr-2.6.2.js"></script>
  6. </head>
  7.     <body>
  8.         <canvas id="myCanvas" style="border:1px solid red; width: 200px; height: 100px;"></canvas>
  9.  
  10.         <script type="text/javascript">
  11.             var drawRectangle = function() {
  12.                 var c = document.getElementById("myCanvas");
  13.                 var ctx = c.getContext("2d");
  14.                 ctx.fillStyle = "#FF0000";
  15.                 ctx.fillRect(0, 0, 150, 75);
  16.             };
  17.            
  18.             Modernizr.load([{
  19.                     test: Modernizr.canvas,
  20.                     nope: 'flashcanvas.js',
  21.                     complete: function() {
  22.                         drawRectangle();
  23.                     }
  24.                 }
  25.             ]);
  26.         </script>
  27.     </body>
  28. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top