Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [jQuery] Zmiany w skrypcie
pexter1983
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 29.06.2013

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


Na początku witam na forum. Jestem nowy i mam taki mały problem. Mianowicie:
Mam skrypt:
  1. /* List Ticker by Alex Fish
  2. // www.alexefish.com
  3. //
  4. // options:
  5. //
  6. // effect: fade/slide
  7. // speed: milliseconds
  8. */
  9.  
  10. (function($){
  11. $.fn.list_ticker = function(options){
  12.  
  13. var defaults = {
  14. speed:4000,
  15. effect:'slide'
  16. };
  17.  
  18. var options = $.extend(defaults, options);
  19.  
  20. return this.each(function(){
  21.  
  22. var obj = $(this);
  23. var list = obj.children();
  24. list.not(':first').hide();
  25.  
  26. setInterval(function(){
  27.  
  28. list = obj.children();
  29. list.not(':first').hide();
  30.  
  31. var first_li = list.eq(0)
  32. var second_li = list.eq(1)
  33.  
  34. if(options.effect == 'slide'){
  35. first_li.slideUp();
  36. second_li.slideDown(function(){
  37. first_li.remove().appendTo(obj);
  38. });
  39. } else if(options.effect == 'fade'){
  40. first_li.fadeOut(function(){
  41. second_li.fadeIn();
  42. first_li.remove().appendTo(obj);
  43. });
  44. }
  45. }, options.speed)
  46. });
  47. };
  48. })(jQuery);

I chcę dopisać do niego formułę, która wykona akcję zwinięcia w momencie kiedy aktualnie wyświetlane <li></li> będzie miało id="last".

Popełniłem coś takiego:
  1. if (first_li.is(#last) == true) {
  2. $('#slider').fadeOut(2000);
  3. }

Gdzie to wstawić i ewentualnie jak przerobić? Z góry dzięki za pomoc
Go to the top of the page
+Quote Post
Kmils21
post
Post #2





Grupa: Zarejestrowani
Postów: 128
Pomógł: 0
Dołączył: 29.12.2010

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


jak już cos to

is(#last) to jest źle, ma być is("#last")


--------------------
Go to the top of the page
+Quote Post

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 Aktualny czas: 22.08.2025 - 04:29