CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: JavaScript

Jquery Teletype Image Plugin

367 Views
Copy Code Show/Hide Line Numbers
   1:  //***************************************
   2:  // Description: Display images in a simple teletype style.
   3:  // Usage: $(".teletype").teletype({speed: 100});
   4:  // Put all images in wrapper <div>
   5:  // e.g : <div class="teletype"><img src="/images/1.jpg" alt="" width="10" height="10"/> ... </div>
   6:  // Ensure the images are hidden 
   7:  // e.g : .teletype img { display: none }
   8:  // Params example: ({speed:100},{type:"fast"});
   9:  // Written by: Arran Maclean , A R Media Ltd.  22/03/2010
  10:  //***************************************
  11:  ;(function($){   
  12:      $.fn.teletype = function(params) {   
  13:        
  14:        params = $.extend( 
  15:        {speed: 100},
  16:        {type: ''},
  17:        params); // capture speed or use default
  18:        
  19:          return this.each(function() {   
  20:          
  21:              var ming = $("img",this);
  22:              var count = (ming.length);
  23:              var c = 0;
  24:              to = setInterval(function (){
  25:                   $(ming[c]).show(params.type);
  26:                   c++
  27:                      if (c >= count){
  28:                              clearInterval(to);
  29:                      }
  30:              },  params.speed); //end interval 
  31:               
  32:         });// end return each
  33:         
  34:       }; // end type   
  35:  })(jQuery);
by ArranM
  March 22, 2010 @ 6:36am
Tags:
Description:
Display images wrapped with in target div one after another. Teletype.

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate