i'm very confused about the error i got. It's hard to describe and give information about but i try:
i put the sketch.js Paintingtool on my site. On iPhone it doesn't work so i searched a solution. Here i finally found it und after i added it to the code i refreshed my page and all works fine.
Then i added this code in my function what you see below.
Now i tried on iPhone again and it doesn't worked. When i refresh the page it works without trouble.
With my laptop on the newest chrome browser everything works without refresh.
Can't i combine jQuery in Javascript code?
Here the code i use:
<div id="test">
<canvas id="tools_sketch"></canvas>
<script>
(function() {
var canvas = document.getElementById('tools_sketch'),
context = canvas.getContext('2d');
// resize the canvas to fill browser window dynamically
window.addEventListener('resize', resizeCanvas, false);
function resizeCanvas() {
canvas.height = window.innerHeight;
canvas.width = infobox.offsetWidth;
$(function() {
$('#tools_sketch').sketch();
});
}
resizeCanvas();
})();
</script>
</div>
<div class="tools center">
<a class="btn btn-primary" href="#tools_sketch" data-tool="marker">Pen</a>
<a class="btn btn-primary" href="#tools_sketch" data-tool="eraser">Rubber</a>
<a class="btn btn-primary" href="#tools_sketch" data-download="png">Send</a>
</div>
Thanks for reading
EDIT: When i add the code from the official sketch.js to a new file on the server and reset the other file with that it works on iPhone. When i then change one line its broken. When i reset this line again its still broken. wtf!
EDIT2: On Firefox 3.0 from 2008 it works, on Safari 3.1 from 2008 too -> not a old browser problem