Smooth Horizontal List Scroll

I've been trying to figure out how to do a smooth scrolling horizontal list with javascript for a while now and I just noticed that the EE menu bar does exactly what I am trying to do (when you click the "More" link). Looking through the source code I couldn't really figure out how they were achieving it. Does anybody know how I can do this effect?

Basically I need to be able to scroll through a horizontal list on the push of a button so that new items come into view. Exactly how they do it here on EE.
LVL 4
jfredricksonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Running the risk of getting the standards people on my back:
FF and IE both support the marquee tag
Since it is just html, all things in the marquee are accessible to the browser and to search engines

Here is an alas IE only (unless I can find out how to code onBounce for FF)

<a href="#" onClick="document.getElementById('m1').direction='left'; document.getElementById('m1').start(); return false"><<</a>|
<marquee id="m1" scrollamount="10" onClick="this.stop()" onBounce="this.stop()" behavior="alternate" direction="right" width="75%">
[<a href="">Link01</a>]
[<a href="">Link02</a>]
[<a href="">Link03</a>]
[<a href="">Link04</a>]
[<a href="">Link05</a>]
[<a href="">Link06</a>]
[<a href="">Link07</a>]
[<a href="">Link08</a>]
[<a href="">Link09</a>]
[<a href="">Link10</a>]
[<a href="">Link11</a>]
[<a href="">Link12</a>]
[<a href="">Link13</a>]
[<a href="">Link14</a>]
[<a href="">Link15</a>]
[<a href="">Link16</a>]
[<a href="">Link17</a>]
[<a href="">Link18</a>]
[<a href="">Link19</a>]
[<a href="">Link20</a>]
</marquee>|
<a href="#" onClick="document.getElementById('m1').direction='right'; document.getElementById('m1').start(); return false">>></a>
0
jfredricksonAuthor Commented:
Would it be possible to get something that doesn't bounce around but just sits there like normal and only scrolls when you click the button? I am looking for the exact functionality of the categories menu at the top of the EE page.
0
Michel PlungjanIT ExpertCommented:
That is not smooth scrolling it is showing and hiding

function ToggleList(zonePosition)
{
  this.first = document.getElementById('compZnNavF');
  this.second  = document.getElementById('compZnNavL');
  this.cont = document.getElementById('compZnNavCont');
  if(zonePosition == 1)
  {
     this.second.className = 'hide';
     this.first.className = '';
     this.cont.className = 'next';
  }
  else
  {
     this.first.className = 'hide';
     this.second.className = '';
     this.cont.className = '';
  }

  this.toggleNavs = function() {
    if(this.first.className == 'hide')
    {
       this.second.className = 'hide';
       this.first.className = '';
       this.cont.className = 'next';
    }
    else
    {
       this.first.className = 'hide';
       this.second.className = '';
       this.cont.className = '';
    }
  }
}

0
Michel PlungjanIT ExpertCommented:
<div id="compZnNav"><a id="compZnNavCont" class="next" onmouseup="toggleList.toggleNavs()"></a><div id="compZnNavCl"><ul id="compZnNavF">

<li class="firstChild" id="r5297"><span class=" root5297"><a href="/Microsoft/"><span>Microsoft</span></a></span></li>
<li class="nCur" id="r5349"><span class=" root5349"><a href="/Apple/"><span>Apple</span></a></span></li>
<li class="nCur" id="r5374"><span class=" root5374"><a href="/Internet/"><span>Internet</span></a></span></li>
<li class="nCur" id="r5624"><span class=" root5624"><a href="/Gamers/"><span>Gamers</span></a></span></li>
<li class="nCur" id="r5375"><span class=" root5375"><a href="/Digital_Living/"><span>Digital Living</span></a></span></li>
<li class="nCur" id="r5377"><span class=" root5377"><a href="/Virus_and_Spyware/"><span>Virus &amp; Spyware</span></a></span></li>
<li class="nCur" id="r5625"><span class=" root5625"><a href="/Hardware/"><span>Hardware</span></a></span></li>
<li class="nCur" id="r3062"><span class=" root3062"><a href="/Software/"><span>Software</span></a></span></li>

<li class="nCur" id="r5379"><span class=" root5379"><a href="/ITPro/"><span>ITPro</span></a></span></li>
<li class="nCur" id="r5380"><span class=" root5380"><a href="/Developer/"><span>Developer</span></a></span></li>
</ul><ul id="compZnNavL"><li class="nCur" id="r5381"><span class=" root5381"><a href="/Storage/"><span>Storage</span></a></span></li>
<li class="nCur" id="r5382"><span class=" root5382"><a href="/OS/"><span>OS</span></a></span></li>
<li class="nCur" id="r5383"><span class=" root5383"><a href="/Database/"><span>Database</span></a></span></li>
<li class="nCur" id="r5384"><span class=" root5384"><a href="/Security/"><span>Security</span></a></span></li>
<li class="current" id="r5628"><span class=" root5628"><a href="/Programming/"><span>Programming</span></a></span></li>
<li class="nCur" id="r5385"><span class=" root5385"><a href="/Web_Development/"><span>Web Development</span></a></span></li>
<li class="nCur" id="r5626"><span class=" root5626"><a href="/Networking/"><span>Networking</span></a></span></li>

<li class="nCur" id="r5627"><span class=" root5627"><a href="/Other/"><span>Other</span></a></span></li>
</ul></div></div>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michel PlungjanIT ExpertCommented:
and the stylesheet
#compZnNavCont{float:right;position:relative;margin-right:1px;margin-bottom:10px;background-repeat:no-repeat;width:2%;height:25px;display:block;cursor:pointer;background-image:url(/expert/images/zonePrev.gif);background-position:0 7px;z-index:2}
#compZnNav .next{background-image:url(/expert/images/zoneNext.gif)}
#compZnNav{top:64px;margin:0;position:absolute;width:100%;height:26px;white-space:nowrap;background:url(/expert/images/zoneNav.gif) repeat-x;padding:0}
.IE #compZnNav{position:relative;top:-32px}
#compZnNav UL{margin:0;height:26px;position:relative;clear:none;overflow:hidden}
#compZnNav #compZnNavL{background:url(/expert/images/zoneNav.gif) repeat-x;position:relative;height:26px}
#compZnNav .hide{display:none}
#compZnNav LI{background:url(/expert/images/zoneDivider.gif) 100% 100% no-repeat;display:block;margin:0;float:left;padding:0 1px 0 0;height:26px;width:auto;text-align:center}
#compZnNav LI SPAN{line-height:16px}
#compZnNav #r5297{width:10%}
#compZnNav #r5349{width:8%}
#compZnNav #r5374{width:10%}
#compZnNav #r5624{width:9%}
#compZnNav #r5375{width:12%}
#compZnNav #r5377{width:14%}
#compZnNav #r5625{width:9%}
#compZnNav #r3062{width:9%}
#compZnNav #r5379{width:7%}
#compZnNav #r5380{width:10%}
#compZnNav #r5381{width:10%}
#compZnNav #r5382{width:7%}
#compZnNav #r5383{width:10%}
#compZnNav #r5384{width:10%}
#compZnNav #r5628{width:11%}
#compZnNav #r5385{width:14%}
#compZnNav #r5626{width:10%}
#compZnNav #r5627{width:7%}
#compZnNav LI A, #compZnNav LI A:hover{display:block;text-decoration:none;overflow:hidden;height:10px;padding:5px 0 10px 0}
#compZnNav .current A{background:url(/expert/images/zoneNavCurrent.gif) repeat-x}
#compZnNav LI A SPAN{font-weight:bold;font-size:11px;color:#ffffff}
#compZnNav LI A:hover{text-decoration:none}
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.