این اسلایدر به علت کوچیک بودن و افکت جدید کاربرد زیادی داره
دمو:
http://biger.rozblog.com/page/slider2
این کد را قبل از تگ head/قرار بدین
<link href="http://biger.rozup.ir/css/demo8/picslid.css" rel="stylesheet" type="text/css" />
واین هم کد اسلایدر:
<script>
var imgurl= new Array()
var message= new Array()
var thislink= new Array()
// set the url (or path) of your images. Add as many images as you like
imgurl[0]="عکس اول"
imgurl[1]="عکس دوم"
// set the messages corresponding to the images above (no more no less than the images above)
message[0]="موضوع عکس اول"
message[1]="موضوع عکس دوم"
// set the links corresponding to the images above (no more no less than the images above)
// If you dont want to add a link enter a #"instead of http://www.mylink.com, see smaple below
thislink[0]="آدرس عکس اول"
thislink[1]="آدرس عکس دوم"
// width of pictures (pixel)
var imgwidth=300
// width of pictures (pixel)
var imgheight=180
// set stillstand of picture (seconds)
var stillstand=2.5
// set opacity-strength (transparency-effect). Values may range from 1 to 100
var opacitystrength=60
// Do not edit below this line
var tmr
var step=10
var i=imgwidth
var i_imgurl=0
stillstand*=1000
var preloadedimages=new Array()
for (iii=0;iii<imgurl.length;iii++){
preloadedimages[iii]=new Image()
preloadedimages[iii].src=imgurl[iii]
}
function shrinkpic() {
document.getElementById("textbox").innerHTML=""
if (i>0) {
i-=step
document.getElementById("picdiv").style.width=i+"px"
document.getElementById("picdiv").style.height=i*(imgheight/imgwidth)+"px"
document.getElementById("picdiv").style.left=imgwidth/2-(i/2)+"px"
document.getElementById("picdiv").style.top=(imgwidth/2-(i/2))*(imgheight/imgwidth)+"px"
tmr=setTimeout("shrinkpic()",20)
}
else {
i_imgurl++
if (i_imgurl>=imgurl.length) {
i_imgurl=0
}
document.getElementById("picdiv").style.background="url("+imgurl[i_imgurl]+")"
i=1
tmr=setTimeout("enlargepic()",20)
}
}
function enlargepic() {
if (i<=imgwidth) {
i+=step
document.getElementById("picdiv").style.width=i+"px"
document.getElementById("picdiv").style.height=i*(imgheight/imgwidth)+"px"
document.getElementById("picdiv").style.left=imgwidth/2-(i/2)+"px"
document.getElementById("picdiv").style.top=(imgwidth/2-(i/2))*(imgheight/imgwidth)+"px"
tmr=setTimeout("enlargepic()",20)
}
else {
i=imgwidth
showmessage()
}
}
function showmessage() {
document.getElementById("textbox").innerHTML='<span class="textboxbackgroundstyle">'+message[i_imgurl]+'</span>'
tmr=setTimeout("shrinkpic()",stillstand)
}
function gotothislink(){
document.location.href=thislink[i_imgurl]
}
document.write('<div id="roof" style="position:relative;width:'+imgwidth+'px;height:'+imgheight+'px;">')
document.write('<div id="picdiv" class="curveandshadowstyle" style="position:absolute;background:url('+imgurl[0]+');width:'+imgwidth+'px;height:'+imgheight+'px;top:0px;left:0px;"></div>')
document.write('<div id="tt" onClick="gotothislink()" style="position:absolute;width:'+imgwidth+'px;height:'+imgheight+'px;top:0px;left:0px;filter:alpha(opacity='+opacitystrength+');opacity:'+(opacitystrength/100)+';cursor:pointer;"><table width='+imgwidth+' height='+imgheight+'><tr><td id="textbox" class="textboxstyle"><span class="textboxbackgroundstyle">'+message[0]+'</span></td></tr></table></div>')
document.write('</div>')
window.onload=shrinkpic
</script>
و اما نکات و آموزش
نکات:
عکس هی شما باید در اندازه های
300x180
باشند
برای افزودن تصویر بایدبدین صورت عمل کنید
برای افزودن تصویر باید کد زیر رو در زیر کد عکس ها اضافه کنید
imgurl[number pic u]="عکس مورد نظر"
برای افزودن توضیح عکس مورد نظر
message[number pic u]="متن شما"
برای افزودن آدرس به عکس جدید
thislink[number pic u]="آدرس"
اگر به کدها نگاه کنید می فهمید که باید هرکدام رو کجا وارد کنید
اهام گرفته از یک سایت محیط زیست
