Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [jQuery/jqtransform] Dodanie do kodu stylu inputa
einter-project
post 17.12.2011, 18:53:54
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

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: 14.08.2025 - 14:05