Diana
Diana

Reputation: 328

Slide a ul li list with controls horizontaly with jquery

Sorry if this was posted before, I'm looking for a script that scrolls an ul list horizontally with controls, most examples get ruined because li itens should have the same fixed width while texts are in different lenghts.

<div id="slidelist">
<span class="nav-prev"><a href="#">&laquo;</a></span>
<div class="listarea">
<ul id="submen">
<li>Home</li>
....
</ul>
</div>
<span class="nav-next"><a href="#">&raquo;</a></span>
</div>

CSS:

#slidelist #submen ul  {display:block; height:20px; position:absolute}

#slidelist #submen ul li {display:inline; border:none; margin-right:20px}

#slidelist .listarea {width:90%;float:left;}

#slidelist .nav-prev {float:left;width:20px;}
#slidelist .nav-next {float:right;width:20px;}

Clicking the prev an next scroll or slide the list inside the div.

menu with slider

Upvotes: 2

Views: 2662

Answers (1)

NullPoiиteя
NullPoiиteя

Reputation: 57322

try something like

$(".nav-prev").click(function(){$(this).show('slide', { direction: 'left' }, 1000);})
$(".nav-next").click(function(){$(this).show('slide', { direction: 'left' }, 1000);})

Upvotes: 1

Related Questions