Jump to content
php.lv forumi
  • 0

js interval


Question

Posted

Sveiki, sekojoša problēma. Ir sliders ar automātisko bilžu maiņu, tas pat nav slaideris, bet nu lai nu paliek, galvenais, ka automātiski.

 

http://paste.php.lv/e9d6cdc8d03f4ab61fd6aa1fc2ef4744/nonum

 

Problēma ir tur, ka, ja teiksim ir palikusi 1 sekunde līdz intervāla beigām, tad atverot jauno bildi pēc sekundes tā nomainas. Kā panākt, ka uzspiežot uz jaunas lietas intervāls tiktu "restartēts"?

 

Paldies un ceru uz ātru atbildi

7 answers to this question

Recommended Posts

  • 0
Posted (edited)

nop :)

 

     	clearInterval(rotateBg);
     	setInterval(rotateBg,5000);

 

same, bet varētu būt, ka otro rindu nepareizi daru, ne?

pamēģināju arī tīri setinterval, nu nav

Edited by anonīms
  • 0
Posted
var intervalId;

//Palaižam intervālu   	 
intervalId = setInterval(intervalFunc, 5000);

//Apturam intervālu
clearInterval(intervalId);

function intervalaFunc(){
   alert('Funkcija izsaukta');
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...