b0y-101 Mini Shell


Current Path : E:/www/advanced-mba/javascripts/
File Upload :
Current File : E:/www/advanced-mba/javascripts/Slideshow.js

var jquery = $.fn;

jquery.extend({
  SplitID : function()
  {
    return this.attr('id').split('-').pop();
  },

  Slideshow : {
    Ready : function()
    {
      $('div.tmpSlideshowControl')
        .hover(
          function() {
            $(this).addClass('tmpSlideshowControlOn');
          },
          function() {
            $(this).removeClass('tmpSlideshowControlOn');
          }
        )
        .click(
          function() {
            jquery.Slideshow.Interrupted = true;

            $('div.tmpSlide').hide();
            $('div.tmpSlideshowControl').removeClass('tmpSlideshowControlActive');

            $('div#tmpSlide-' + $(this).SplitID()).show()
            $(this).addClass('tmpSlideshowControlActive');
          }
        );

      this.Counter = 1;
      this.Interrupted = false;

      this.Transition();
    },

    Transition : function()
    {
      if (this.Interrupted) {
        return;
      }

      this.Last = this.Counter - 1;

      if (this.Last < 1) {
        this.Last = 4;
      }

      $('div#tmpSlide-' + this.Last).fadeOut(
        'slow',
        function() {
          $('div#tmpSlideshowControl-' + jquery.Slideshow.Last).removeClass('tmpSlideshowControlActive');
          $('div#tmpSlideshowControl-' + jquery.Slideshow.Counter).addClass('tmpSlideshowControlActive');
          $('div#tmpSlide-' + jquery.Slideshow.Counter).fadeIn('slow');

          jquery.Slideshow.Counter++;

          if (jquery.Slideshow.Counter > 4) {
            jquery.Slideshow.Counter = 1;
          }

          setTimeout('jquery.Slideshow.Transition();', 6000);
        }
      );
    }
  }
});

$(document).ready(
  function() {
    jquery.Slideshow.Ready();
  }
);

Copyright © 2019 by b0y-101