iziModal icon indicating copy to clipboard operation
iziModal copied to clipboard

iziModal('open') on click not working (ES6 import or jQuery issue?)

Open JayBox325 opened this issue 6 years ago • 2 comments

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

JayBox325 avatar Apr 24 '18 15:04 JayBox325

try using JQuery version 2

UsepRusnandar avatar Apr 25 '18 03:04 UsepRusnandar

Pretty sure this is because of #198 I was able to fix this by defining var for userAgent in the code being imported.

RiFi2k avatar Jul 07 '18 02:07 RiFi2k