$(document).ready(function() { $('#slideshow').cycle({ fx: 'fade', speed: 2500, timeout: 2000 }); if(typeof window.slideHeight == 'undefined'){ var slideHeight = 432; } else { var slideHeight = window.slideHeight; } //slidein animation if(calcRightHeight() > slideHeight) { $("#rightscrollcontrol").show(); } // scrollcontent $("#rightscrollcontrol .up").click(function() { if ($('#rightscroll').is(':animated')) { return false; } else { rightscrollUp(); } }); $("#rightscrollcontrol .down").click(function() { if ($('#rightscroll').is(':animated')) { return false; } else { rightscrollDown(); } }); function rightscrollUp() { if($("#rightscroll #scrollpage").position().top < 0) { $("#rightscrollcontrol .down").removeClass("disabled"); $("#rightscroll #scrollpage").animate({"top": "+="+slideHeight+"px"}, 700, function() { calcRightControls(); }); } } function rightscrollDown() { if(-$("#rightscroll #scrollpage").position().top + slideHeight < calcRightHeight()) { $("#rightscrollcontrol .up").removeClass("disabled"); $("#rightscroll #scrollpage").animate({"top": "-="+slideHeight+"px"}, 700,function() { calcRightControls(); }); } } function calcRightControls() { if(-$("#rightscroll #scrollpage").position().top + slideHeight > calcRightHeight()) { $("#rightscrollcontrol .down").addClass("disabled"); } if($("#rightscroll #scrollpage").position().top >= 0){ $("#rightscrollcontrol .up").addClass("disabled"); } } function calcRightHeight() { return $("#rightscroll #scrollpage").height(); } $("a[rel=fbox]").fancybox(); });