Live Brilliant

좌우 무한 슬라이드 롤링 스크립트 본문

개발은 핵찜이야/SCRIPT

좌우 무한 슬라이드 롤링 스크립트

주인정 2012. 4. 17. 15:15

/* =========================================== */
/* This code has been tested in */
/* Internet Explorer 6, FireFox 1, */
/* Netscape 7, Opera 7, and eBay */
/* =========================================== */
; var AuctionThum=new Array()
; var AuctionLink=new Array()
; var AuctionDesc=new Array()
; var ImgWidRatio=new Array()
; ImgWidRatio[0]="2.5"
;
; AuctionThum[1]="/images/newmain/mk_01.jpg"
; AuctionLink[1]="http://도메인"
; AuctionDesc[1]="이미지 설명 1"

; AuctionThum[2]="/images/newmain/mk_02.jpg"
; AuctionLink[2]="http://도메인"
; AuctionDesc[2]="이미지 설명 2"

; AuctionThum[3]="/images/newmain/mk_03.jpg"
; AuctionLink[3]="http://도메인"
; AuctionDesc[3]="이미지 설명 3"

; AuctionThum[4]="/images/newmain/mk_04.jpg"
; AuctionLink[4]="http://도메인"
; AuctionDesc[4]="이미지 설명 4"

; AuctionThum[5]="/images/newmain/mk_05.jpg"
; AuctionLink[5]="http://도메인"
; AuctionDesc[5]="이미지 설명 5"

; AuctionThum[6]="/images/newmain/mk_06.jpg"
; AuctionLink[6]="http://도메인"
; AuctionDesc[6]="이미지 설명 6"

; AuctionThum[7]="/images/newmain/mk_07.jpg"
; AuctionLink[7]="http://도메인"
; AuctionDesc[7]="이미지 설명 7"

; AuctionThum[8]="/images/newmain/mk_08.jpg"
; AuctionLink[8]="http://도메인"


; AuctionThum[9]="/images/newmain/mk_09.jpg"
; AuctionLink[9]="http://도메인"
; AuctionDesc[9]="이미지 설명 9"

; AuctionThum[10]="/images/newmain/mk_10.jpg"
; AuctionLink[10]="http://도메인"
; AuctionDesc[10]="이미지 설명 10"

; AuctionThum[11]="/images/newmain/mk_11.jpg"
; AuctionLink[11]="http://도메인"
; AuctionDesc[11]="이미지 설명 11"

;
; var scrollspeed ="50" //스크롤 속도
; var borderd ="0px" //보더두께
; var slideborder ="#555555" //보더색상
; var slidebgcolor="#ffffff" //배경색상
; var textcolor ="#222222" //텍스트 색상
; var gallerywidth="860px" //슬라이더 가로크기
;

var slider1, slider2, maxWid=0; var sliderwidth=0;
var quot="'"; var scrollamount=-1; var thCnt=0;
var CrossSellimages=new Array();
for (var i=1; i<=AuctionThum.length; i++){if (AuctionThum[i]){thCnt++;
if (!ImgWidRatio[i]) {ImgWidRatio[i]=ImgWidRatio[0]};
CrossSellimages[thCnt]='<a href="'+AuctionLink[i]+'" target=_blank>'+
'<img src="'+AuctionThum[i]+'" width="'+Math.round(64*ImgWidRatio[i])+'" height="150" hspace="2" vspace="4" border="0" '+
' -nmouseover="thumbwow(this.alt,this.offsetLeft,this.offsetWidth,'+quot+AuctionDesc[i]+quot+')" '+
' title="" alt="'+i+'" ></a>';
sliderwidth=sliderwidth+Math.round((64*ImgWidRatio[i])+6);
if (ImgWidRatio[i]>maxWid){maxWid=ImgWidRatio[i]}
}};
var sliderheight=0;
var CrossSellStrip='<nobr>'+CrossSellimages.join("&nbsp;")+'</nobr>';
if (sliderwidth-maxWid*64<parseInt(gallerywidth)){gallerywidth=Math.abs(sliderwidth-maxWid*64)}
function setupGallery(){
document.write('<table border="0" cellspacing="0" cellpadding="0" style="position:relative; border:'+borderd+' '+slideborder+' solid; background-color:'+slidebgcolor+'; width:'+(parseInt(gallerywidth)+2)+'px; height:158px;"><tr><td align="center">');
document.write('<div style="position:relative;width:'+gallerywidth+'px;height:158px;overflow:hidden;">');
document.write('<div style="position:absolute;left:0px;bottom:0px;width:'+gallerywidth+'px;height:158px;" -nMouseover="scrollamount=0" -nMouseout="scrollamount=-1">');
document.write('<div id="slidegroup1" style="position:absolute;left:0px;bottom:0px;"></div>');
document.write('<div id="slidegroup2" style="position:absolute;left:0px;bottom:0px;"></div>');
document.write('<div id="blowup" style="position:absolute;left:0px;bottom:0px;visibility:hidden;border:0px '+slideborder+' solid;" -nmouseout="unwow()"></div>');
document.write('</div></div>');
//설명글 document.write('</td></tr><tr><td align="center" id="slidelabel" style="padding:2px; font-family:sans-serif; font-size:14px; font-weight:normal; color:'+textcolor+'">');
document.write('</td></tr></table>');
};
function loadimages(){
slider1=document.getElementById("slidegroup1");
slider2=document.getElementById("slidegroup2");
slider1.innerHTML=CrossSellStrip;
slider2.innerHTML=CrossSellStrip;
slider2.style.left=""+sliderwidth+"px";
startaction=setInterval("slideleft()",parseInt(scrollspeed));
};

function slideleft(){
if (parseInt(slider1.style.left)>(sliderwidth*(-1)))
{slider1.style.left=(parseInt(slider1.style.left)+scrollamount)+"px"}
else
{slider1.style.left=(parseInt(slider2.style.left)+sliderwidth+scrollamount)+"px"}
if (parseInt(slider2.style.left)>(sliderwidth*(-1)))
{slider2.style.left=(parseInt(slider2.style.left)+scrollamount)+"px"}
else
{slider2.style.left=(parseInt(slider1.style.left)+sliderwidth)+"px"}
};

function thumbwow(num,thumOffset,thumSize,label){
if (parseInt(slider1.style.left)<=0){
if (thumOffset+parseInt(slider1.style.left)>0-thumSize){
leftstart=thumOffset+parseInt(slider1.style.left)
}else{
leftstart=thumOffset+parseInt(slider2.style.left)
}
}
else {
if (thumOffset+parseInt(slider2.style.left)>0-thumSize){
leftstart=thumOffset+parseInt(slider2.style.left)
}else{
leftstart=thumOffset+parseInt(slider1.style.left)
}
};
document.getElementById("blowup").style.left=leftstart+0+(Math.round((thumSize-thumSize/0.8-2)/2))+"px";
/*마우스온시 확대이미지*/
document.getElementById("blowup").innerHTML='<a href="'+AuctionLink[num]+'" target=_blank>'+
'<img src="'+AuctionThum[num]+'" width="185" height="155" border="0" ></a>';
document.getElementById("blowup").style.visibility="visible";
//설명글 document.getElementById("slidelabel").innerHTML=label;
};
function unwow(){document.getElementById("blowup").style.visibility="hidden";
// document.getElementById("slidelabel").innerHTML=document.getElementById("slidelabel").title
};

<!-- 실행스크립크 -->

<script language="JavaScript1.2">
setupGallery();
loadimages();
</script>

 

'개발은 핵찜이야 > SCRIPT' 카테고리의 다른 글

스크립트안에서 charset 설정하기  (0) 2012.04.17
탭 메뉴/배너 롤링  (0) 2012.04.17
레이어 롤링효과  (0) 2012.04.17
3D 갤러리 소스  (0) 2012.04.17
퀵메뉴(사이드 따라다니는 메뉴)  (0) 2012.04.17
Comments