iziModal
iziModal copied to clipboard
iziModal('open') on click not working (ES6 import or jQuery issue?)
I have tried to put together an iziModal in a test build project just to try and see it in action, but it's not firing on my click event for me. Here is my modals.js
file:
import iziModal from 'izimodal/js/izimodal.js'
$.fn.iziModal = iziModal // possible fix read elsewhere
$(document).on('click', '.trigger', function (e) {
e.preventDefault()
$('#modal').iziModal('open')
})
I am transpiling and compiling this with other basic JS functions into bundle.js. And I'm thinking that this issue is to do with jQuery from what I've read elsewhere so I've moved things around in trying to get it to work, so at the time of writing this is in my HTML:
<script type="text/javascript" src="./public/assets/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="./public/assets/js/bundle.js"></script>
And my iziModal markup is from the documentation for now:
<div id="modal"><!-- data-iziModal-fullscreen="true" data-iziModal-title="Welcome" data-iziModal-subtitle="Subtitle" data-iziModal-icon="icon-home" -->
<!-- Modal content -->
</div>
<!-- Trigger to open Modal -->
<a href="https://github.com/dolce/iziModal" class="trigger">Modal</a>
I am compiling and transpiling with Gulp Babel if that makes any difference but I'm sure it's something simple. But once it doesn't work followed by three or four tries at fixing it and it still doesn't work, and days pass of going away and coming back... Raising an Issue is all I got!
Thanks, Jay
try using JQuery version 2
Pretty sure this is because of #198 I was able to fix this by defining var for userAgent in the code being imported.