Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [jQuery/jqtransform] Dodanie do kodu stylu inputa
einter-project
post
Post #1





Grupa: Zarejestrowani
Postów: 39
Pomógł: 0
Dołączył: 9.09.2011

Ostrzeżenie: (10%)
X----


Witam

Na stronie muszę zastosować ostylowane formularze. Problem w tym że jest kilka styli tych samych pól formularza. Grafika poniosło.

W jaki sposób przekazać styl z pola do funkcji (korzystam z jqtransform):

Na przykład pole input
<input class="searchInput" type="text" name="searchAccommodation" value="">

I teraz chciałbym nazwę klasy wsadzić w:
$input.addClass("jqTransformInput").wrap('<div class="jqTransformInputWrapper_tutaj nazwe klasy"><div class="jqTransformInputInner"><div></div></div></div>');

  1.  
  2. /***************************
  3. Text Fields
  4. ***************************/
  5. $.fn.jqTransInputText = function(){
  6. return this.each(function(){
  7. var $input = $(this);
  8.  
  9. if($input.hasClass('jqtranformdone') || !$input.is('input')) {return;}
  10. $input.addClass('jqtranformdone');
  11.  
  12. var oLabel = jqTransformGetLabel($(this));
  13. oLabel && oLabel.bind('click',function(){$input.focus();});
  14.  
  15. var inputSize=$input.width();
  16. if($input.attr('size')){
  17. inputSize = $input.attr('size')*10;
  18. $input.css('width',inputSize);
  19. }
  20.  
  21. $input.addClass("jqTransformInput").wrap('<div class="jqTransformInputWrapper_tutaj nazwe klasy"><div class="jqTransformInputInner"><div></div></div></div>');
  22. var $wrapper = $input.parent().parent().parent();
  23. $wrapper.css("width", inputSize+10);
  24. $input
  25. .focus(function(){$wrapper.addClass("jqTransformInputWrapper_focus");})
  26. .blur(function(){$wrapper.removeClass("jqTransformInputWrapper_focus");})
  27. .hover(function(){$wrapper.addClass("jqTransformInputWrapper_hover");},function(){$wrapper.removeClass("jqTransformInputWrapper_hover");})
  28. ;
  29.  
  30. /* If this is safari we need to add an extra class */
  31. $.browser.safari && $wrapper.addClass('jqTransformSafari');
  32. $.browser.safari && $input.css('width',$wrapper.width()+16);
  33. this.wrapper = $wrapper;
  34.  
  35. });
  36. };
  37.  


Bardzo prosiłbym o pomoc jak to rozwiązać.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
einter-project
post
Post #2





Grupa: Zarejestrowani
Postów: 39
Pomógł: 0
Dołączył: 9.09.2011

Ostrzeżenie: (10%)
X----


Dzięki za pomoc, ale jak dodałem poniżej pola input problem zniknął. Za to pojawił się nowy którego już nie wiem jak rozwiązać. Jak zaznaczę pole formRegistrationFV skrypt powinien zrobić aktywne poniżej pola. Bez jqtransform wszystko działa jak ma działać. Jak dodam tylko jqtransform to skrypt reaguje po 2 kliku i działa na odwrót.

  1. <script type="text/javascript">
  2. function customerInvoiceVat() {
  3. var chkAll = document.getElementById('formRegistrationFV');
  4.  
  5. if(chkAll.checked == true){
  6. document.registration.formInvoiceCompany.disabled = false;
  7. document.registration.formInvoiceCompany.className = 'RegistrationInput';
  8. document.getElementById('ID_invoiceCompany').className = 'text';
  9.  
  10. document.registration.formInvoiceName.disabled = false;
  11. document.registration.formInvoiceName.className = 'RegistrationInput';
  12. document.getElementById('ID_invoiceName').className = 'text';
  13.  
  14.  
  15. } else {
  16. document.registration.formInvoiceCompany.disabled = true;
  17. document.registration.formInvoiceCompany.className = 'RegistrationInputNot';
  18. document.getElementById('ID_invoiceCompany').className = 'textNot';
  19.  
  20. document.registration.formInvoiceName.disabled = true;
  21. document.registration.formInvoiceName.className = 'RegistrationInputNot';
  22. document.getElementById('ID_invoiceName').className = 'textNot';
  23. }
  24. }
  25.  
  26. window.onload = customerInvoiceVat;
  27.  


Link do strony: http://31.178.13.71/ogloszenia/customerPan...ateRegistration
Jak rozwiązać aby działał za pierwszym klikiem i nie na odwrót?

Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 14.10.2025 - 16:16