Screencast – How To Create An ‘Easy Gallery’ jQuery Plugin

Screencast – How To Create An ‘Easy Gallery’ jQuery Plugin

OK then today we're going to take a look at creating a jQuery Plugin for a nice and easy, opacity filled, picture gallery. The aim of this fifteen minute video screencast/tutorial is to help you with basic plugin development and get you used to writing plugins from scratch. Continue Reading...

Video Tutorial:

Final Code

/**
  * Easy Gallery jQuery Plugin
  * Author: Drew Douglass
  * Version: 0.1
  *
  *
  */
(function($){
  	$.fn.easyGallery = function(settings) {

  		//setup some options
  		var opts = $.extend({}, $.fn.easyGallery.defaults,settings);
  		return this.each(function(setting){
  			var options = $.extend({}, opts, $(this).data());
  			$(this).hover(function(){
  				$(this).siblings().stop().animate({
  					opacity: options.opacity
  				},options.duration);
  			}, function(){
  				$(this).siblings().stop().animate({
  					opacity: options.originalOpacity
  				},options.duration);
  			});
  		});

  	}
  	$.fn.easyGallery.defaults = {
  		duration: 500,
  		opacity: 0.5,
  		originalOpacity: 1
  	}
})(jQuery);

Helpful Resources

Thank to Jarel Remick for providing the free demo images.

Net Premium: web dev education from the professionals.

Related Posts

Enjoy This Article

PG

Drew Douglass

This author has not yet added a biography. However no worries, it's coming soon. Just be patient!

WooThemes - WordPress themes for everyone

5 Comments

  1. Thiago Belem says:

    Great tutorial! Very very nice… :)

  2. sam says:

    For some reason this crashes IE8 big time..

  3. mutuelle sante says:

    good tutorial. thanks

  4. [...] Drew Douglass – How To Create An ‘Easy Gallery’ jQuery Plugin [...]

  5. rachat credit says:

    Very good tutoial. Many thanks.



Leave a Reply