TShopping

 找回密碼
 註冊
搜索
查看: 2703|回復: 4
打印 上一主題 下一主題

[教學] 捲動式選單

[複製鏈接]
跳轉到指定樓層
1#
發表於 2010-1-22 00:41:07 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
 
Push to Facebook
  1. <style type="text/css">
  2. #divBg{position:absolute; z-index:10; width:200; left:0; height:100; clip:rect(0,10,10,0)}
  3. #divMenu{position:absolute; left:15; top:6; font-weight:bold}
  4. #divArrowLeft{position:absolute; width:20; height:20; left:0; top:9}
  5. #divArrowRight{position:absolute; width:20; height:20; top:9}
  6. </style>

  7. <script type="text/javascript" language="javascript">
  8. function checkBrowser(){
  9. this.ver=navigator.appVersion
  10. this.dom=document.getElementById?1:0
  11. this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
  12. this.ie4=(document.all && !this.dom)?1:0;
  13. this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
  14. this.ns4=(document.layers && !this.dom)?1:0;
  15. this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
  16. return this
  17. }
  18. bw=new checkBrowser()

  19. sLeft=0
  20. sTop=0

  21. sMenuheight=30

  22. sArrowwidth=15

  23. sScrollspeed=20
  24. sScrollPx=10

  25. /*
  26. Scrolling functions
  27. */
  28. var tim=0
  29. var noScroll=true
  30. function mLeft(){
  31. if(!noScroll && oMenu.x<sArrowwidth){
  32. oMenu.moveBy(sScrollPx,0)
  33. tim=setTimeout("mLeft()",sScrollspeed)
  34. }
  35. }
  36. function mRight(){
  37. if(!noScroll && oMenu.x>-(oMenu.scrollWidth-(pageWidth))-sArrowwidth){
  38. oMenu.moveBy(-sScrollPx,0)
  39. tim=setTimeout("mRight()",sScrollspeed)
  40. }
  41. }
  42. function noMove(){clearTimeout(tim); noScroll=true}
  43. /*
  44. Object part
  45. */
  46. function makeObj(obj,nest,menu){
  47. nest=(!nest) ? '':'document.'+nest+'.'
  48. this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;
  49. this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;
  50. this.scrollWidth=bw.ns4?this.css.document.width:this.evnt.offsetWidth
  51. this.x=(bw.ns4 || bw.ns5)? this.css.left:this.css.pixelLeft;
  52. this.y=(bw.ns4 || bw.ns5)? this.css.top:this.css.pixelTop;
  53. this.moveBy=b_moveBy; this.moveIt=b_moveIt; this.showIt=b_showIt;this.clipTo=b_clipTo;
  54. return this
  55. }
  56. function b_moveBy(x,y){this.x=this.x+x; this.y=this.y+y; this.css.left=this.x; this.css.top=this.y}
  57. function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}
  58. function b_clipTo(t,r,b,l){
  59. if(bw.ns4){this.css.clip.top=t; this.css.clip.right=r; this.css.clip.bottom=b; this.css.clip.left=l
  60. }else this.css.clip="rect("+t+","+r+","+b+","+l+")";
  61. }
  62. function b_showIt(){this.css.visibility="visible"}
  63. /*
  64. Object part end
  65. */

  66. function sideInit(){
  67. pageWidth=(bw.ns4 || bw.ns5)?innerWidth:document.body.offsetWidth-20;

  68. oBg=new makeObj('divBg')
  69. oMenu=new makeObj('divMenu','divBg',1)
  70. oArrowRight=new makeObj('divArrowRight','divBg')
  71. oBg.moveIt(sLeft,sTop)
  72. oMenu.moveIt(sArrowwidth,6)
  73. oArrowRight.moveIt(pageWidth-sArrowwidth,9)
  74. if(bw.dom || bw.ie4){ oBg.css.width=pageWidth; oBg.css.overflow="hidden" }
  75. oBg.clipTo(0,pageWidth,sMenuheight,0)
  76. }

  77. onload=sideInit;
  78. </script>

  79. <div id="divBg">
  80. <div id="divMenu"><table><tr><td nowrap>
  81. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁一</font></a><font size="3">
  82. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁二</font></a><font size="3">
  83. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁三</font></a><font size="3">
  84. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁四</font></a><font size="3">
  85. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁五</font></a><font size="3">
  86. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁六</font></a><font size="3">
  87. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁七</font></a><font size="3">
  88. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁八</font></a><font size="3">
  89. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁九</font></a><font size="3">
  90. <a href="<a href=http://topia.yam.com/home/livemusic/pages/index.htm" target=_blank>http://topia.yam.com/home/livemusic/pages/index.htm"</a> target="_blank"><font size="3">連結網頁十</font></a>
  91. </font></font></font></font></font></font></font></font></font></td></tr></table>
  92. </div>
  93.  <div id="divArrowLeft"><a href="javascript://" onmouseover="noScroll=false; mLeft()" onmouseout="noMove()"><img src="<a href=http://home.kimo.com.tw/dislee1/1" target=_blank>http://home.kimo.com.tw/dislee1/1"</a> width=20 height=20 border=0></A></div>
  94.  <div id="divArrowRight"><a href="javascript://" onmouseover="noScroll=false; mRight()" onmouseout="noMove()"><img src="<a href=http://home.kimo.com.tw/dislee1/2" target=_blank>http://home.kimo.com.tw/dislee1/2"</a> width=20 height=20 border=0></a></div>
  95. </div><br>
複製代碼

<a href="http://topia.yam.com/home/livemusic/pages/index.htm" target="_blank"><font size="3">連結網頁一</font></a><font size="3">修改連結文字與大小及連結網址和跳頁方式
<img src="http://home.kimo.com.tw/dislee1/1" width=20 height=20 border=0></A>修改圖片網址

 

臉書網友討論
2#
發表於 2013-11-14 00:43:30 | 只看該作者
不錯,看看。  

版主招募中

3#
發表於 2013-11-14 00:43:30 | 只看該作者
ding   支持  


4#
發表於 2013-11-14 00:43:30 | 只看該作者
支持~~頂頂~~~  


5#
發表於 2014-6-13 00:54:19 | 只看該作者
呵呵,支持一下!


*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-11-1 08:05 , Processed in 0.045309 second(s), 18 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表