var $stickyLink=$("#sticky-link"),leftBox=document.getElementById("sticky-left-box"),$sticky=$("#sticky-right-box .sticky"),$borderBox=$("#sticky-border-box"),curSticky=$sticky.first(),lastSticky=curSticky,nextSlideInterval; function startSliding() { nextSlideInterval = setInterval("nextSlide()",4000); } function nextSlide() { lastSticky = curSticky; if($(curSticky).is($sticky.last())){curSticky = $sticky.first();}else{curSticky = $(curSticky).next();} nextSlideAnim(); } function nextSlideAnim() { animProperties={duration:300,queue:false,easing:"swing"}; $borderBox.animate({"top":$(curSticky).position().top+"px"},animProperties); if(!$(lastSticky).is(curSticky)) { $(leftBox).children().eq($(curSticky).index()).fadeTo(400,1); $(leftBox).children().eq($(lastSticky).index()).fadeTo(400,0); } updateStickyLink(); } function stickyInit() { $sticky.mouseenter(function(ev) { clearInterval(nextSlideInterval); lastSticky = curSticky; curSticky=ev.delegateTarget; nextSlideAnim(); }); $sticky.mouseleave(startSliding); startSliding(); $(leftBox).children().eq($(curSticky).index()).fadeTo(400,1); updateStickyLink(); } function updateStickyLink() { $stickyLink.attr("href",$(curSticky).find(".sticky-permalink").attr("href")); $stickyLink.attr("title",$(curSticky).find(".sticky-permalink").attr("title")); setAnchors(); } $stickyLink.click(function(){location.href=$stickyLink.attr("href");}) $(document).ready(stickyInit); $(window).bind("resize load", function() { topWidth = $(".post-permalink").first().width(); $sticky.each(function(index,el) { $permalink = $(el).find(".sticky-permalink"); $excerpt = $(el).find(".sticky-excerpt"); if($permalink.width() == topWidth) {$permalink.addClass("dotted");} else {$permalink.removeClass("dotted");} if($excerpt.width() == topWidth) {$excerpt.addClass("dotted");} else {$excerpt.removeClass("dotted");} }); });