﻿$(document).ready(function() {
    $("#content-slider").slider({
        animate: true,
        change: handleSliderChange,
        slide: handleSliderSlide,
        orientation: "vertical"
    });
});


function handleSliderChange(e, ui) {
    var maxScroll = $("div[id^='content-scroll']").attr("scrollHeight") -
                  $("div[id^='content-scroll']").height();
    $("div[id^='content-scroll']").animate({ scrollTop: ui.value *
     (maxScroll / 100)
    }, 1000);
}

function handleSliderSlide(e, ui) {
    var maxScroll = $("div[id^='content-scroll']").attr("scrollHeight") -
                  $("div[id^='content-scroll']").height();
    $("div[id^='content-scroll']").attr({ scrollTop: ui.value * (maxScroll / 100) });
}
