Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][JavaScript]Płynne przejście zdjęć
Kloc
post
Post #1





Grupa: Zarejestrowani
Postów: 115
Pomógł: 8
Dołączył: 8.06.2014

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


Siemanko, jak mogę uzyskać efekt płynnego przejścia pomiędzy obrazkami w galerii na stronie, bo po wgraniu na serwer ma efekt "przycinania" się?
Za zmianę odpowiada js, po wywołaniu funkcji onclick="change()".

  1. background = new Array();
  2. background[0] = 'obrazek.jpg';
  3. background[1] = 'obrazek2.jpg'';
  4. background[2] = 'obrazek3.jpg'';
  5. background[3] = 'obrazek4.jpg'';
  6.  
  7. function change() {
  8. val = document.getElementById('ksztalt6');
  9. value = val.getAttribute('data-value');
  10. if(value < background.length - 1){
  11. id = ++value
  12. document.getElementById("ksztalt6").setAttribute('data-value', id);
  13. }
  14.  
  15. else{
  16. document.getElementById("ksztalt6").setAttribute('data-value', 0);
  17. }
  18. }
  19.  
  20. function show() {
  21. val = document.getElementById('ksztalt6');
  22. id = val.getAttribute('data-value');
  23. document.getElementById("top").style.backgroundImage = 'url('+background[id]+')';
  24. document.getElementById("top").style.transition = 'background-image 2s 0s';
  25. }


Ten post edytował Kloc 25.06.2014, 13:01:22
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: 5.04.2026 - 01:26