Hi this code is working perfect without magento.
<script src="flipbook.js"></script>
<script src="jquery.js"></script>
<script>
$('#side').FlipBook({
pdf: 'sample.pdf',
});
</script>
i added to flipbook.js to view/frontend/templates/web/js and added to layout
<script src="test_test::js/flipbook.js"/>
phtml
<div id="side></div>
<script>
require(['jquery'], function($){
$('#side').FlipBook({
pdf: 'sample.pdf',
});
});
</script>
Can u explain why its not working? And how can i fix it?
asked Apr 24, 2019 at 14:35
Ibrahim Aldar
1251 silver badge11 bronze badges
-
Is there any error in browser console?Prathap Gunasekaran– Prathap Gunasekaran2019年04月25日 05:11:37 +00:00Commented Apr 25, 2019 at 5:11
-
yea, Uncaught TypeError: $(...).FlipBook is not a function at 17:992 at Object.execCb (require.js:1650) at Module.check (require.js:866) at Module.enable (require.js:1143) at Module.init (require.js:774) at require.js:1416Ibrahim Aldar– Ibrahim Aldar2019年04月25日 10:00:10 +00:00Commented Apr 25, 2019 at 10:00
1 Answer 1
Try this,
<script>
require(['jquery','FlipBook'], function($){
$('#side').FlipBook({
pdf: 'sample.pdf',
});
});
</script>
For more about the implementation custom javascript implementation
Hope this helps.
answered Apr 25, 2019 at 10:59
Prathap Gunasekaran
3,2891 gold badge17 silver badges39 bronze badges
default