Can vertical scrolling with ul and li be done via jQuery?
-
22-01-2021 - |
Question
Example : http://www.net-a-porter.com/product/163606
So far my code:
<style type="text/css">
li {float:left;height:50px}
</style>
<div style="height:100px">
<a href="#" class="top">up</a>
<ul>
<li>Product 1</li>
<li>Product 2</li>
<li>Product 3</li>
<li>Product 4</li>
<li>Product 5</li>
<li>Product 6</li>
</ul>
<a href="#" class="down">down</a>
</div>
Solution 2
@Shai. Do you know why this is not working. I am finding out if there is more than three LI than show arrows. Otherwise do not show arrows:
jQuery(document).ready(function() {
var ulx;
var totalli;
ulx = document.getElementById("mycarousel");
totali = ulx.children.length;
if (totali > 3){
$(".jcarousel-next").hide();
$(".jcarousel-prev").hide();
}else{
// buttons appear
}
jQuery('#mycarousel').jcarousel({
vertical: true,
scroll: 2
});
});
UPDATED - Solution:
jQuery(document).ready(function() {
var ulx = document.getElementById("mycarousel");
var totalli = ulx.children.length;
if (totalli > 3) {
jQuery('#mycarousel').jcarousel({vertical:true,scroll:2});
} else {
jQuery('#mycarousel').jcarousel({vertical:true,scroll:2});
$(".jcarousel-next").hide();$(".jcarousel-prev").hide();
}
});
OTHER TIPS
You could post the inner UL inside a div with overflow:hidden, and move the inside UL's position up and down, and by that creating a sort of a scroll effect.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow