3

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
2
  • Is there any error in browser console? Commented 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:1416 Commented Apr 25, 2019 at 10:00

1 Answer 1

0

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
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.