$(document).ready(function(){
  $("#content-slider").slider({
    animate: true,
    change: handleSliderChange,
    slide: handleSliderSlide
  });
});

function handleSliderChange(e, ui)
{
  var maxScroll = $("#scrollable").attr("scrollWidth") - $("#scrollable").width();
  $("#scrollable").animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000);
}

function handleSliderSlide(e, ui)
{
  var maxScroll = $("#scrollable").attr("scrollWidth") - $("#scrollable").width();
  $("#scrollable").attr({scrollLeft: ui.value * (maxScroll / 100) });
}
