Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [jQuery]Toggle rozwija się i zwija
weogrim
post 24.09.2010, 17:49:08
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 1
Dołączył: 23.08.2008

Ostrzeżenie: (0%)
-----


Witam.

Napisałem sobie taką funkcje w jQuery:

[JAVASCRIPT] pobierz, plaintext
  1. function showAlert(type, message) {
  2. if(type == 'ok') {
  3. $('#message').html('<div class="message-ok">'+message+'</div>').toggle('slow')
  4. }else if(type == 'error') {
  5. $('#message').html('<div class="message-error">'+message+'</div>').toggle('slow');
  6. }
  7. }
[JAVASCRIPT] pobierz, plaintext


W html mam diva z id message:

  1. <div id='message'></div>
,

a tą funkcję wywołuje tak:

  1. echo "<a onclick='showAlert(\"ok\", \"Treść informacji\")'>asddsadsa</a>";


I teraz mam taki problem: po kliknięciu na link div message rozwija się i od razu zwija, i dopiero za drugim kliknięciem pojawia się na stałe.

Tutaj filmik, jak bym nie jasno wytłumaczył: Youtube.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 24.06.2025 - 19:10