It is currently Sat Dec 02, 2017 4:04 pm
Advanced search
Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.
by attaboy123 » Fri Sep 28, 2012 2:28 am
This is my code:
- Code: Select all
$(document).ready(function() {
var canvas = document.getElementById('canvas'),
context = canvas.getContext('2d'),
image = new Image();
image.src = 'pattern_054.gif';
context.drawImage(image, 75, 220);
});
It works fine in Opra and FF but not Safari and Chrome, any ideas?
-
attaboy123
- <h6>
-
- Posts: 5
- Joined: Thu Jun 28, 2012 11:57 pm
by zcorpan » Fri Sep 28, 2012 8:34 am
You try to paint the image on the canvas before it has loaded. You need to wait for image.onload, then drawImage().
-
zcorpan
- <article>
-
- Posts: 807
- Joined: Tue Feb 06, 2007 8:29 pm
- Location: Sweden
by JAB Creations » Fri Sep 28, 2012 1:00 pm
Also if you don't want your performance to suck use real JavaScript, not frameworks like jQuery when scripting.
-
JAB Creations
- <aside>
-
- Posts: 566
- Joined: Tue Mar 13, 2007 4:48 am
- Location: Sarasota Florida, USA
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 1 guest