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

How to instantiate the plugin? #28

Closed
mila85 opened this issue Jan 12, 2012 · 6 comments
Closed

How to instantiate the plugin? #28

mila85 opened this issue Jan 12, 2012 · 6 comments

Comments

@mila85
Copy link

mila85 commented Jan 12, 2012

Sorry, my friends, but I will write my question in portuguese. This is the first time i will send a issue, so if has something wrong with my question, please tell me.

No site em português do jqueryboilerplate (br.jqueryboilerplate.com) existe a informação de que o aplicativo "Não adere às sugestões feitas pela documentação do jQuery em relação ao Plugins/Authoring e fazendo isso provê melhor performance e uso de memória por não criar múltiplas instâncias de si mesmo".

Eu criei um plugin para modal que é acionado a partir de um botão. Fiz o plugin baseado nesta documentação Plugins/Authoring e tive este problema de múltiplas instâncias. Encontrei o jqueryboilerplate(v3-0) e tentei remodelar meu plugin baseado nele, mas estou com uma dúvida básica: como devo fazer a chamada ao plugin?

$(function(){
$('button.modal').click(function() {
???
});
});

@kane-thornwyrd
Copy link
Contributor

Desculpe, eu não entendo português, eu uso o Google Translate.
Você pode criar um "Gist", ou mesmo um repositório, para nos mostrar como você fez o seu plugin ?

@mila85
Copy link
Author

mila85 commented Jan 12, 2012

Hi! Thank you for try speak in portuguese with me. I will try to do the same for you (tranks to google translate):
I created a modal plugin based on the "jQuery Alert Dialogs Plugin" and it require the "jquery.ui.tabs.js". It was designed to display in tabs the code html and css of the requested page.

The code has a mix of portugues and english. Sorry for that.
https://gist.github.com/5b7bf8313e70f11bf18f

@kane-thornwyrd
Copy link
Contributor

I forked it, and will see what I can do, tonight.
In case of "serious" language problems, i think that @zenorocha won't be impaired ;)

@mila85
Copy link
Author

mila85 commented Jan 12, 2012

Ok! Thank you, kane-thornwyrd. I appreciate your help. ;)
If necessary we can wait for @zenorocha 's help.

@kane-thornwyrd
Copy link
Contributor

Theorically, by creating a module this way, to use it you have to do something like:
$('#my_element).jModalCodigo();

But without intending to be offensive, it seems that you don't understand jQuery that well… And that is such a sad thing, because you seem to try to use jQuery UI and at the same time recreate your own modal dialog in a way that do not let any doubt about your experience.
I do not have enough time, right now, to trying to re-enact what you tried to achieve… That's pretty frustrating for me.

Take a look at http://docs.jquery.com/UI/Dialog

I'll try to bargain with my planning to do something about this.

@zenorocha
Copy link
Member

Oh lord! I answered to this and my post it's not here =/

Sorry guys, let's go again.

First of all, you should not visite br.jqueryboilerplate.com, his content was related to the old version of the plugin and I've just took it offline.

To instantiate a plugin you should write exaclty what @kane-thornwyrd tould you:

$(function(){
    $('button.modal').click(function() {
        $('#my_element).jModalCodigo();
    });
});

But you should listen that he says, you don't need to recreate jQuery UI modal plugin, study it better and you'll understand


Ai meu deus, eu respondi isso daqui mas parece que não foi =/

Foi mal, vamos tentar de novo =/

Primeiramente, desconsidera esse site br.jqueryboilerplate.com, o conteúdo dele era relativo a versão antiga do plugin e como estava desatualizado tirei ele do ar.

A forma de se instanciar um plugin é exatamente como o @kane-thornwyrd mostrou:

$(function(){
    $('button.modal').click(function() {
        $('#my_element).jModalCodigo();
    });
});

Mas leve o que ele falou em consideração, você não precisa recriar o plugin de modal do jQuery UI, dê uma estudada melhor na biblioteca que você vai entender.

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

3 participants