Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania i odpowiedzi
Viewing all articles
Browse latest Browse all 83240

Odpowiedź: Zsynchronizowany slider z nawigacją.

$
0
0

Bardzo mocno uproszczony kod, mam nadzieje, że znasz transition lub keyframes oraz działanie slidera . Kod w pure JS.

document.getElementById("jakisUchwyt").addEventListener('load', function (){slider(0);}, 'false');



function slider (index)
{
if ( index == tablica.length) 
{
 index = 0;
}
// TU jest kod twojego slidera
refreshNav (jakies i do iteracji); // Przekazujesz i do funkcji. 
setTimeout (functon () { slider(index);}, 5000) // Jakis pomiar czasowy.
}

function refreshNav (index)

{

document.getElementById(index).classList.add('dodajPodkreslenie); // Jak umiesz obłsugiwać keyframes to wiesz jak to zrobic.

var createHref = document.createElement('a');

createHref.setAttribute ('href' , "moja_strona" + index);

document.getElementById(index).apppendChild(createHref);

}

Wypadałoby by napisać jeszcze skrypt , który by sprawdzał czy istnieją już takie odnośniki. Ale to zostawiam tobie :).


Viewing all articles
Browse latest Browse all 83240

Latest Images

Trending Articles