Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Błąd w moim kodzie - missing : after property id
finito
post
Post #1





Grupa: Zarejestrowani
Postów: 110
Pomógł: 0
Dołączył: 16.12.2012

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


Ślęczę nad tym i ślęczę i nie mogę znaleźć tej literówki. W okolicy 31...32 jest błąd...To musi być jakaś moja literów, bo nawet nie wiem gdzie miałbym zapomnieć o ":". Pomożecie? W znalezieniu? Nie wiem. Gdzieś nawiasu nie dopisałem?

  1. (function($){
  2. $.fn.changeColor = function(options)
  3. {
  4.  
  5. function onClick(event){
  6. //cialo metody prywatnej
  7. $this = $(this);
  8. data = $this.data('changeColor');
  9. data.first = !data.first;
  10. $this.css("backgroundColor", data.first ? data.colorSecond : data.colorFirst);
  11. return true;
  12. }
  13. //metody publiczne
  14. var methods = {
  15. swapColors: function(){
  16. $this=$(this);
  17. data = $this.data('changeColor');
  18. tmp = data.colorSecond;
  19. data.colorSecond = data.colorFirst;
  20. data.colorFirst = tmp;
  21. },
  22. destroy: function(){
  23. //destruktor
  24. $this = $(this);
  25. $this.unbind("click");
  26. $this.css("backgroundColor","");
  27. $this.removeData("changeColor");
  28. }
  29. };
  30. return this.each(function()({
  31. if(methods[options])
  32. {
  33. return methods[options].apply(this,arguments);
  34. }
  35. else if (typeof options === ' object ' || ! options){
  36. //parametry pluginu
  37. var settings = $.extend({
  38. colorFirst:'Red',
  39. colorSecond:'Green'
  40. },options);
  41.  
  42. $this = $(this);
  43. data = $this.data('changeColor');
  44. if (!data)
  45. {
  46. data = $this.data('changeColor',settings);
  47. $this.bind('click',onClick);
  48. }
  49. $this.css("background-color",settings.colorFirst);
  50. data.first=true;
  51. return;
  52. }
  53.  
  54. else
  55. {
  56. //bład
  57. $.error('changeColor: no method: '+ options);
  58. }
  59.  
  60. });
  61.  
  62. }
  63.  
  64. })(jQuery);
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 2.10.2025 - 09:13