Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Js error on 1.5.0 #85

Closed
maikealame opened this issue May 12, 2017 · 22 comments
Closed

Js error on 1.5.0 #85

maikealame opened this issue May 12, 2017 · 22 comments

Comments

@maikealame
Copy link

Hey,

Look this error, it happen at any time when change window and back

iziModal.js:1195 Uncaught TypeError: Cannot read property 'split' of undefined
at jQuery.fn.init.$.fn.(anonymous function) [as iziModal] (http://gsa.localhost/assets/scripts/frontend.js:53257:24)
at HTMLDocument. (http://gsa.localhost/assets/scripts/frontend.js:53233:26)
at HTMLDocument.dispatch (http://gsa.localhost/assets/scripts/frontend.js:5206:27)
at HTMLDocument.elemData.handle (http://gsa.localhost/assets/scripts/frontend.js:5014:28)

@marcelodolza
Copy link
Owner

marcelodolza commented May 13, 2017

@maikealame, em que ocasião ocorre este erro?
O seletor que vc usou era ID ou Class? E quais eram?

@maikealame
Copy link
Author

@Dolce Segue abaixo:

[view]

<script>
$(document).ready(function() {
        $("body").on("click",".btnView",function(e){
                e.preventDefault();
                e.target = e.currentTarget;
                if(!e.target.href) return;
                $("#modalTicket").iziModal("setSubtitle", "Ocorrencia 123");
                $("#modalTicket").iziModal("open",e);
         });
 });
</script>
<div id="modalTicket" class="izimodal-iframe" data-icon="fa fa-exclamation-triangle" data-title="Visualizar Ocorrência" data-subtitle="." data-width="1100" data-height="500">
</div>

[global.js]

$(document).ready(function(){
        $(".izimodal-iframe").each(function(i,e){
                izimodalIframe(e);
        });
});

function izimodalIframe(e){
    $(e).addClass("iziModal").iziModal({
        title: $(e).attr("title") || $(e).data("title") || '',
        subtitle: $(e).attr("subtitle") || $(e).data("subtitle") || '',
        iconClass: $(e).data("icon") || '',
        iconColor: $(e).data("icon-color") || '#FFF',
        headerColor: $(e).data("header-color") || '#337ab7',
        padding: $(e).data("padding") || 0,
        width: $(e).data("width") || $(window).width() / 100 * 80,
        fullscreen: $(e).data("fullscreen") || false,
        openFullscreen: $(e).data("fullscreen-open") || false,
        iframe: true,
        iframeHeight: $(e).data("height") || $( window ).height()-200,
        iframeURL: $(e).data("url") || null,
        history: false,
        autoOpen: false,
        onOpening: function(){
            $(e).find('iframe').load(function(){
                var m = $(this).contents();


                // insert hidden field for interface modal
                var form = $(m).find('form');
                form.find("input._interface").remove();
                form.append(frameModal);


                // aborted to finish modal
                $(m).find("#_modalFrameClose").click(function(){
                    $(window).focus();
                    $(e).iziModal("close");
                });
                $(m).find(".btnModalClose").click(function(ev){
                    ev.preventDefault();
                    $(window).focus();
                    $(e).iziModal("close");
                });

                $(this).resize();
            });
        },
        onClosed: function(){
            document.location.hash = "";
        },
        onOpened: function (e) {
            
        }
    });
}

@marcelodolza
Copy link
Owner

@maikealame, tem certeza que é erro do plugin?
Se sim, poderia colocar o exemplo em alguma plataforma debugável?

@sweell
Copy link

sweell commented May 19, 2017

Hi dolce,
i've the same error with jQuery 3.2.1, I think it's incompatible with the new jQuery framework.
Bye, Luigi

@maikealame
Copy link
Author

@Dolce segue
https://jsfiddle.net/maikealame/01xhvvbf/

O erro acontece quando alguma tecla é pressionada (Clique no result container antes)

@marcelodolza
Copy link
Owner

@maikealame, aqui seu exemplo não está rodando..
Só uma dica, você pode adicionar a lib do izimodal (css/js) como external resources, dai não precisaria copiar o plugin inteiro pro exemplo..

@maikealame
Copy link
Author

@Dolce qual link ? não encontrei nenhuma cdn com a versão 1.5
Faltou salvar, pode olhar novamente

@marcelodolza
Copy link
Owner

erro: Uncaught TypeError: a.indexOf is not a function

Eu vi que está usando as options dessa forma: $(e).data("icon") ...
Porque não usa: data-iziModal-icon"icon"?

@maikealame
Copy link
Author

Opa, tenta de novo. Eu esqueci de colocar o jquery migrated em external resources. O erro é exatamente esse quando aperto uma tecla
Uncaught TypeError: Cannot read property 'split' of undefined
at jQuery.fn.init.t.fn.(anonymous function) [as iziModal]

@marcelodolza
Copy link
Owner

@maikealame, nenhum erro por enquanto aqui. Qual navegador/versão está utilizando?

@maikealame
Copy link
Author

Edge 14 - Firefox 53 - Chrome 58
Assim: no jsfiddle tu não está dando focus na tela, pq é um iframe a renderização do resultado, tem que clicar no container (iframe) com a renderização (pode ser do lado dos btn, não precisa abrir o modal) depois aperta qualquer tecla e vai ver o erro.

image

@karedas
Copy link

karedas commented Jun 1, 2017

The same thing, the error comes on any keydown of the keyboard. It does not matter to initialize izimodal, just include it.

@marcelodolza
Copy link
Owner

Acontece a mesma coisa nesse exemplo?
https://jsfiddle.net/01xhvvbf/8/

@maikealame
Copy link
Author

Sim, não conseguiu visualizar o erro ?

@marcelodolza
Copy link
Owner

Agora sim @maikealame, ja sei o que é 👍

@marcelodolza
Copy link
Owner

@maikealame , tenta novamente nesse exemplo, veja se o erro persiste.
https://jsfiddle.net/01xhvvbf/12/

@maikealame
Copy link
Author

Nenhum erro agora. Valeu

@marcelodolza
Copy link
Owner

@maikealame. Show! até o fds eu atualizo o repositório e todas as dependencias. valeu!

@karedas
Copy link

karedas commented Jun 5, 2017

thanks!

@marcelodolza
Copy link
Owner

@mourad1081
Copy link

Can you please speak in english ? I have this issue and it seems that @karedas solved his issue by his "thanks" but I don't understand anything.

@evbermudez
Copy link

you may have initialized iziModal and the element that you are targeting doesn't exist on the current page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants