i have:
<script src="https://unpkg.com/split.js/dist/split.min.js"></script>
<script type="module">
$(document).ready(function() {
import Split from 'split.min.js'
Split(['#split-0', '#split-1'],
{
direction: 'vertical'
});
});
</script>
So, i have an error:
Uncaught SyntaxError: Unexpected identifier
Error referencing to import Split from 'split.js'
What should i do? Code was copied from official site.
If you use the UMD build of script, as you do in your example by referencing the URL
https://unpkg.com/split.js/dist/split.min.js
, the Split object is not exposed as a JavaScript module that can be accessed through an import statement.Instead, it will be available as a global variable, which you can access through
window.Split
or simplySplit
.This should work: