![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 188 Pomógł: 1 Dołączył: 4.07.2009 Skąd: ... Ostrzeżenie: (10%) ![]() ![]() |
Witam.
Poniżej mam napisaną funkcję hover dla pewnego elementu. Chcę by ta funkcja wykonała się tylko wtedy gdy myszka będzie na tym elemencie 2 lub więcej sekund. Gdy zaś będzie krócej lub wcale to ma się nie wykonywać. Poniżej kod który napisałem:
|
|
|
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 1 729 Pomógł: 346 Dołączył: 4.04.2009 Ostrzeżenie: (0%) ![]() ![]() |
coś w ten deseń
dostosuj pod siebie -------------------- |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 260 Pomógł: 14 Dołączył: 8.09.2011 Ostrzeżenie: (0%) ![]() ![]() |
Ewentualnie uzyc jQuery + wtyczka jQuery Timers.
W onMouseOver odpalasz wtedy timer na 2000 ms, a w funkcji callback timera robisz co tam chcesz zrobić po uplywie 2 sekund. jQuery timers ma calkiem spore mozliwosci, i jesli masz czas to polecam sie zainteresowac ![]() -------------------- "The first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time."
Tom Cargill, Bell Labs |
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 188 Pomógł: 1 Dołączył: 4.07.2009 Skąd: ... Ostrzeżenie: (10%) ![]() ![]() |
Ewentualnie uzyc jQuery + wtyczka jQuery Timers. W onMouseOver odpalasz wtedy timer na 2000 ms, a w funkcji callback timera robisz co tam chcesz zrobić po uplywie 2 sekund. jQuery timers ma calkiem spore mozliwosci, i jesli masz czas to polecam sie zainteresowac ![]() Możesz pokazać to na moim przykładzie?? Zrobiłem to tak lecz nie działa: Kod var timer;
$(function(){ $('section.zespol_list ul li a').hover(function(){ timer = setTimeout(function() { $(this).next().fadeIn(1000); }, 2000); }, function(){ clearTimeout(timer); $(this).next().fadeOut(1000); }); }); |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 13.07.2025 - 19:44 |