幻灯片定时器 - 如何暂停定时器

时间:2017-06-21 23:34:28

标签: timer slideshow jscript

我刚接触到jscript和iv环顾四周并看到了一些幻灯片中暂停图像的想法,但我只是无法正确编码...如果有人愿意帮助自己和许多其他人将从中受益一个简单的解决方法,请务必输入您的专业知识。谢谢。兔子

这里是剧本......

    (function() {
   'use strict';

   var preloads=[],c,
       d=document,di=d.getElementById('dynamic-image'),
       dh=d.getElementById('dynamic-href'),
       url=[
           'linkmywebsite.ml','chatmagbingo.com','ilkestonwebdesign.com','ipost.com','happypetsuk.com','www.linkmywebsite.co.uk','fireworksnottingham.co.uk','www.linkmywebsite.co.uk','ilkestonfastfood.com','www.linkmywebsite.co.uk','de-signz.co.uk','www.linkmywebsite.co.uk','cctautos.com','grundyskips.co.uk','www.m8drivingschools.co.uk','www.apipedream.co.uk','www.crazyskips.com','www.linkmywebsite.co.uk','www.linkmywebsite.co.uk','www.linkmywebsite.co.uk','www.linkmywebsite.co.uk','www.linkmywebsite.co.uk','www.competitiveremovals.co.uk','www.linkmywebsite.co.uk','www.linkmywebsite.co.uk','heartinternet.co.uk','winnerbingo.com','www.linkmywebsite.co.uk','linkmywebsite.ml','katyperry.com','perfectpizza.com','youtube.com','google.com','facebook.com','twitter.com','linkmywebsite.ml','linkmywebsite.ml','gumtree.com'
          ],

       thereallyconfusingpart-was-timer=11000;  /*adjust to suit */



function preload(){
for(c=0;c<arguments.length;c++) {
   preloads[preloads.length]=new Image();
   preloads[preloads.length-1].src=arguments[c];
  }
   c=0;
 }


preload('yournewsite2.png','1ad.jpg','2ad.jpg',
'3ad.jpg','4ad.jpg','5ad.jpg',
'6ad.jpg','7ad.jpg','8ad.jpg',
'9ad.jpg','10ad.jpg','11ad.jpg',
'12ad.jpg','13ad.jpg','14ad.jpg',
'15ad.jpg','16ad.jpg','17ad.jpg',
'18ad.jpg','19ad.jpg','20ad.jpg',
'21ad.jpg','22ad.jpg','23ad.jpg',
'24ad.jpg','25ad.jpg','26ad.jpg',
'27ad.jpg','28ad.jpg','29ad.jpg',
'30ad.jpg','youtubead.png','googlead.png',
'facebookad.png','twitterad.png','yournewsite2.png',
'yournewsite2.png','gumtreead.png');
setInterval(
function() {
   dh.href='http://'+url[c];
   di.src=preloads[c].src;
   di.alt=preloads[c].src.substring(preloads[c].src.lastIndexOf('/')+1);
   c++;
if(c==preloads.length) {
   c=0;
  }
 },thereallyconfusingpart-was-timer);

}());

0 个答案:

没有答案