Javascript: Slide Menu Bar code


SUBMITTED BY: Guest

DATE: Oct. 14, 2013, 12:33 a.m.

FORMAT: JavaScript

SIZE: 3.8 kB

HITS: 1223

  1. <html>
  2. <head>
  3. <style>
  4. <!--
  5. #slidemenubar, #slidemenubar2{
  6. position:absolute;
  7. border:1.5px solid black;
  8. background-color:#F2F2F2;
  9. layer-background-color:#F2F2F2;
  10. font:bold 12px Verdana;
  11. line-height:20px;
  12. }
  13. -->
  14. </style>
  15. </head>
  16. <body>
  17. <script language="JavaScript1.2">
  18. var slidemenu_width=160 //specify width of menu (in pixels)
  19. var slidemenu_reveal=12 //specify amount that menu should protrude initially
  20. var slidemenu_top=170 //specify vertical offset of menu on page
  21. var ns4=document.layers?1:0
  22. var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
  23. var ns6=document.getElementById&&!document.all?1:0
  24. if (ie4||ns6)
  25. document.write('<div id="slidemenubar2" style="left:'+((slidemenu_width-slidemenu_reveal)*-1)+'; top:'+slidemenu_top+'; width:'+slidemenu_width+'" onMouseover="pull()" onMouseout="draw()">')
  26. else if (ns4){
  27. document.write('<style>\n#slidemenubar{\nwidth:'+slidemenu_width+';}\n<\/style>\n')
  28. document.write('<layer id="slidemenubar" left=0 top='+slidemenu_top+' width='+slidemenu_width+' onMouseover="pull()" onMouseout="draw()" visibility=hide>')
  29. }
  30. var sitems=new Array()
  31. ///////////Edit below/////////////////////////////////
  32. //siteitems[x]=["Item Text", "Optional URL associated with text"]
  33. sitems[0]=["<big><font face='Arial'>Site Menu</font></big>", ""]
  34. sitems[1]=["Menus And Navigation", "/"]
  35. sitems[2]=["Document Effects", "/"]
  36. sitems[3]=["Scrollers", "/"]
  37. sitems[4]=["Image Effects", "/"]
  38. sitems[5]=["Links And Buttons", "/"]
  39. sitems[6]=["Dynamic Clocks & Dates", "/"]
  40. sitems[7]=["Text Animations", "/"]
  41. sitems[8]=["Browser Window", "/"]
  42. sitems[9]=["User System Information", "/"]
  43. sitems[10]=["Other", "/"]
  44. //If you want the links to load in another frame/window, specify name of target (ie: target="_new")
  45. var target=""
  46. /////////////////////////////////////////////////////////
  47. if (ie4||ns4||ns6){
  48. for (i=0;i<sitems.length;i++){
  49. if (sitems[i][1])
  50. document.write('<a href="'+sitems[i][1]+'" target="'+target+'">')
  51. document.write(sitems[i][0])
  52. if (sitems[i][1])
  53. document.write('</a>')
  54. document.write('<br>\n')
  55. }
  56. }
  57. function regenerate(){
  58. window.location.reload()
  59. }
  60. function regenerate2(){
  61. if (ns4){
  62. document.slidemenubar.left=((slidemenu_width-slidemenu_reveal)*-1)
  63. document.slidemenubar.visibility="show"
  64. setTimeout("window.onresize=regenerate",400)
  65. }
  66. }
  67. window.onload=regenerate2
  68. rightboundary=0
  69. leftboundary=(slidemenu_width-slidemenu_reveal)*-1
  70. if (ie4||ns6){
  71. document.write('</div>')
  72. themenu=(ns6)? document.getElementById("slidemenubar2").style : document.all.slidemenubar2.style
  73. }
  74. else if (ns4){
  75. document.write('</layer>')
  76. themenu=document.layers.slidemenubar
  77. }
  78. function pull(){
  79. if (window.drawit)
  80. clearInterval(drawit)
  81. pullit=setInterval("pullengine()",10)
  82. }
  83. function draw(){
  84. clearInterval(pullit)
  85. drawit=setInterval("drawengine()",10)
  86. }
  87. function pullengine(){
  88. if ((ie4||ns6)&&parseInt(themenu.left)<rightboundary)
  89. themenu.left=parseInt(themenu.left)+10
  90. else if(ns4&&themenu.left<rightboundary)
  91. themenu.left+=10
  92. else if (window.pullit){
  93. themenu.left=0
  94. clearInterval(pullit)
  95. }
  96. }
  97. function drawengine(){
  98. if ((ie4||ns6)&&parseInt(themenu.left)>leftboundary)
  99. themenu.left=parseInt(themenu.left)-10
  100. else if(ns4&&themenu.left>leftboundary)
  101. themenu.left-=10
  102. else if (window.drawit){
  103. themenu.left=leftboundary
  104. clearInterval(drawit)
  105. }
  106. }
  107. </script>
  108. </body>
  109. </html>

comments powered by Disqus