// featured stories switcher function getstoryid() { var classes = $(".uvmfeaturestory").attr("class"); return classes.match(/\d+/); } function nextslide(next) { // if someone is clicking fast, stop the animation and clear its callback, and move container2 up to get into a completed state before continuing if($("#uvmfeaturec2 > div").length > 0) { $("#uvmfeatureslider").stop(); $("#uvmfeatureslider").css({'left':'0'}); $("#uvmfeaturec1").empty(); $("#uvmfeaturec1").append($("#uvmfeaturec2 > div")); } $("#uvmfeaturec2").css(((next=="next") ? { left: '100%', right: '-100%'} : { left: '-100%', right: '100%'})); $("#uvmfeaturec2").load("/www/utility/frontpage_stories/loadstory.php?storyid="+getstoryid()+"&next="+next, function() { $("#uvmfeatureslider").animate({ left: ((next=="next")?'-100%':'100%')}, 800, 'jswing', function() { $("#uvmfeaturec1 > div").replaceWith($("#uvmfeaturec2 > div")); //changevideourl(); $("#uvmfeatureslider").css({'left':'0'}); }); }); } function changevideourl() { $(".uvmfeaturevideolink").attr("href", "/www/utility/frontpage_stories/video.php?id="+getstoryid()); $(".uvmfeaturevideolink").colorbox({iframe:true, scrolling: false, innerWidth:"440px", innerHeight:"300px"}); } $(document).ready(function() { $('#uvmfeaturenextbutton').click(function() { nextslide("next"); }); $('#uvmfeatureprevbutton').click(function() { nextslide("prev"); }); //changevideourl(); });