marcelodolza / iziModal

Elegant, responsive, flexible and lightweight modal plugin with jQuery.
http://marcelodolza.github.io/iziModal/
Apache License 2.0
2.16k stars 285 forks source link

iZiModal not working with Webpack! #213

Open tr1s opened 6 years ago

tr1s commented 6 years ago

I tried a method I saw in closed issues, but it didn't fully work. Can someone help me solve this please?

I tried using the method where you do $.fn.iziModal = iziModal; and it half worked.

screenshot 2018-10-09 12 01 42

The error went from iziModal not being a function, to iziModal not being defined. But everything works if I just use a CDN, so I know my js works. What am I doing wrong?

This is my js

$(function () {
  $.fn.iziModal = iziModal;

  $("#modal").iziModal({
    title: 'Test',
    subtitle: 'Test',
    headerColor: '#233a79'
  });

  $(document).on('click', '.trigger', function (event) {
    event.preventDefault();
    $('#modal').iziModal('open');
  });

Where am I supposed to put $.fn.iziModal = iziModal;? I tried putting it in the iziModal.min.js, the top of my custom scripts, inside my jQuery document (like the code above), and where I have all my imports, none of these places seem to work. Yes I am importing the iziModal.min.js and css.

Any help would be greatly appreciated thanks!