웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
레이아웃에 스크립트를 이용한 화면을 띄우고 싶은 경우
2008.06.03 08:20
기본적으로 iframe을 사용하기에 원치 않는 분은 수정하지 말아주세요
지금 아래 적혀있는 코드는 layout.html 에 iframe을 이용해서 로고를 넣고
로고는 기본적으로 n개의 이미지로 슬라이드 쑈를 하는.. 자바 스크립트 파일입니다.
이미지나 결과물은 저작권 문제로 첨부하지 않습니다.
회사에서 사용하는 거라. ^^
레이 아웃 파일에서 로고 부분을 다음과 같이 수정 (layouts/xxxx/layout.html)
지금 아래 적혀있는 코드는 layout.html 에 iframe을 이용해서 로고를 넣고
로고는 기본적으로 n개의 이미지로 슬라이드 쑈를 하는.. 자바 스크립트 파일입니다.
이미지나 결과물은 저작권 문제로 첨부하지 않습니다.
회사에서 사용하는 거라. ^^
레이 아웃 파일에서 로고 부분을 다음과 같이 수정 (layouts/xxxx/layout.html)
<!-- 로고설정 --> <iframe src="/layouts/xxxx/leftFrame/slideshow.html" width=249 height=207 frameborder=0 border=0 align=right noframe allowTransparency="true" scrolling="No"> </iframe>
iframe src="/layouts/xxxx/leftFrame/slideshow.html"
여기서 xxxx는 스킨 폴더라시는거 아시죠??
leftFrame이라는 폴더를 만들어서 슬라이드 쇼를 하는 html 코드를 삽입시킨 경우입니다.
ps. 이미지는, 저작권 때문에 첨부를 하지 못합니다.
./layouts/xxxx/leftFrame/slideshow.html
<SCRIPT SRC="frame_Left.js"></SCRIPT>
<!--
<script>
if (ie4||dom)
document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')
</script>
-->
<script>
if (ie4||dom)
document.write('<div style="position:absolute;top:0;left:0;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')
</script>
./layouts/xxxx/leftFrame/frame_Left.js
var curpos=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1
var fadeimages=new Array()
var slideshow_width=247 // image width
var slideshow_height=207 // image height
var pause=2500 // speed (3000=3 seconds)
// image list
fadeimages[0]="./main_02.jpg"
fadeimages[1]="./main_03.jpg"
fadeimages[2]="./main_04.jpg"
fadeimages[3]="./main_05.jpg"
fadeimages[4]="./main_06.jpg"
fadeimages[5]="./main_07.jpg"
fadeimages[6]="./main_08.jpg"
fadeimages[7]="./main_09.jpg"
fadeimages[8]="./main_10.jpg"
fadeimages[9]="./main_11.jpg"
fadeimages[10]="./main_12.jpg"
fadeimages[11]="./main_01.jpg"
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/100
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
setTimeout("rotateimage()",pause)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/100
}
function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
rotateimage()
}
if (ie4||dom)
window.onload=startit
else
setInterval("rotateimage()",pause)
fadeimages[] 에 있는 부분이 이미지 파일들입니다.
이미지는
./layouts/xxxx/leftFrame/ 하위에 집어 넣으시면 됩니다.
댓글 3
-
여등
2008.06.06 01:16
-
dhseo
2008.06.10 08:37
document write 에 포함된 부분을 수정하면 되겠내요
아래와 같이..예를 들어봅니다.! 절대 그대로 사용하지 마세요
test는 안해봤습니다.
./layouts/xxxx/leftFrame/slideshow.html
- <SCRIPT SRC="frame_Left.js"></SCRIPT>
- <!--
- <script>
- if (ie4||dom)
- document.write('<a href ="targeturl"><div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+'+ ';height:'+slideshow_height+';top:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div></a>')
- else
- document.write('<a href="targeturl"><img name="defaultslide" src="'+fadeimages[0]+'"></a>')
- </script>
- -->
- <script>
- if (ie4||dom)
- document.write('<a href ="targeturl"><div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div></a>')
- else
- document.write('<a href="targeturl"><img name="defaultslide" src="'+fadeimages[0]+'"></a>')
- </script>
-
여등
2008.06.11 18:52
dhseo님 감사합니다.
잘 동작하는군요. 홈페이지가 한층 좋아진것 같습니다.
http://www.mylandscape.co.kr
각 그림마다 그림을 클릭하면 특정 화면으로 가게 할려면 어디를 수정하면 될련지요?