kordix
125
1
Laravel

Fabricjs does not work with Laravel

Posted 2 months ago by kordix

I am talking about fabric.js library

That library works fine when i run it outside Laravel, when I include it in the view it simply does not work. That code works perfectly:

  <canvas class="" id="c2"></canvas>

<script>
var canvas = new fabric.Canvas('c2');

var triangle = new fabric.Triangle({ left:50,
  angle: 30,
  width:50,
  height:30,
  selectable:false,
  angle:40 });

canvas.add(triangle);
</script>

But if I run it inside Laravel it just doesn't work. I have indeed the canvas in the view, I load fabric.js library and that script, it even shows errors if I have any. If I don't load fabric.js it shows 'fabric undefined').

Maybe someone had the same problem with that or any other library?

P.S Now i see that if I don't include js/app.js it does work. So it is kind of "biting" with boostrap js?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.