Necesitarás de javascript.
Una leve aproximación
Código HTML:
Ver original<!DOCTYPE html>
<html dir="ltr" lang="es-es"> <meta name="viewport" content="user-scalable=yes, width=device-width, initial-scale=1"> .vertical-menu {
width: 200px;
height: 150px;
overflow: hidden;
}
.vertical-menu .contenedor a {
background-color: #eee;
color: black;
display: block;
padding: 12px;
text-decoration: none;
}
.vertical-menu .contenedor a:hover {
background-color: #ccc;
}
.vertical-menu .contenedor a.active {
background-color: #4CAF50;
color: white;
}
.contenedor {
position: relative;
}
.flechas {
float: right;
width: 3rem;
height: 100%;
position: relative;
background: rgb(255, 0, 0);
z-index: 1;
}
.up {
position: absolute;
top: 0;
}
.down {
position: absolute;
bottom: 0;
}
<div class="vertical-menu"> <a href="#" class="active">PHP
</a> <a href="#">JAVASCRIPT
</a> <a href="#">VISUAL BASIC
</a>
document.addEventListener('DOMContentLoaded', function() {
var vertical_menu = document.querySelector('.vertical-menu'),
contenedor = document.querySelector('.contenedor'),
alto_cont = contenedor.offsetHeight - vertical_menu.offsetHeight,
pos = 0;
document.querySelector('.flechas').addEventListener('click', function(event) {
if (event.target.tagName == 'SPAN') {
if (event.target.className == 'up') {
pos = parseInt(pos + 40);
} else {
pos = parseInt(pos - 40);
}
pos = (Math.abs(pos) > alto_cont) ? -alto_cont : pos;
pos = (pos <= 0) ? pos : 0;
contenedor.style.top = pos + 'px';
}
});
});