我有一个图像滑块,我想在计时器结束时调用推子功能,不幸的是,我是一个完整的新手,似乎只是从我的错误中学习...我知道我漂浮在一个满载同样的船,所以请一位优秀的水手将这艘船转向我们正确的方向。我们都会非常满意您的服务..
我在这里有代码,如果有人能解释我哪里出错了我会非常高兴。谢谢
<script>
function fader (){
var element = document.getElementById("dynamic-image");
element.style.transitionDuration = "2s";
<!---the grabbed element + style [ execute type of effect ] = ' dimension of effect (1 ,2)';--->
element.style.opacity=0;
}
</script>
<script>
(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'
];
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');
setInterval(
function starttimer() {
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;
}
},5000);
}());
不确定在何处调用功能推子。谢谢....
答案 0 :(得分:0)
这是答案.....我再次弄明白......哈哈
因此,对于那些新手来说,这是一个图像推子...简化.....
<style type="text/css">
.dynamic-image {
position:absolute;
left:0%;
top:0%;
width:100%;
height:100%;
</style>
<img id="dynamic-image" class="dynamic-image" src="ebayad.png";>
<script>
function fader (){
var element = document.getElementById("dynamic-image");
element.style.transitionDuration = "2s";
<!---the grabbed element + style [ execute type of effect ] = ' dimension of effect (1 ,2)';--->
element.style.opacity=4;
}
</script>
<script>
function fader2 (){
var element = document.getElementById("dynamic-image");
element.style.transitionDuration = "2s";
<!---the grabbed element + style [ execute type of effect ] = ' dimension of effect (1 ,2)';--->
element.style.opacity=0;
}
</script>
<script>
setInterval( fader2, 4000 );
(function() {
'use strict';
var preloads=[],c,
di=document.getElementById('dynamic-image');
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');
setInterval( fader, 8000 );
setInterval(
function starttimer() {
di.src=preloads[c].src;
c++;
if(c==preloads.length) {
c=0;
}
},8000);
}());
</script>