Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 13th, 2011  |  syntax: None  |  size: 0.90 KB  |  views: 3,748  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. (function($) {
  2.         $(document).ready( function() {
  3.             $('.feature-slider a').click(function(e) {
  4.                 $('.featured-posts section.featured-post').css({
  5.                     opacity: 0,
  6.                     visibility: 'hidden'
  7.                 });
  8.                 $(this.hash).css({
  9.                     opacity: 1,
  10.                     visibility: 'visible'
  11.                 });
  12.                 $('.feature-slider a').removeClass('active');
  13.                 $(this).addClass('active');
  14.                 e.preventDefault();
  15.             });
  16.         });
  17.         var current=1;
  18.         function autoAdvance(){
  19.                 if(current==-1) return false;
  20.                 $('.feature-slider a').eq(current%$('.feature-slider a').length).trigger('click',[true]);       // [true] will be passed as the keepScroll parameter of the click function on line 28
  21.                 current++;
  22.         }
  23.         // The number of seconds that the slider will auto-advance in:
  24.         var changeEvery = 10;
  25.         var itvl = setInterval(function(){autoAdvance()},changeEvery*1000);
  26. })(jQuery);