Return to Snippet

Revision: 19882
at November 3, 2009 02:44 by jeff_way


Initial Code
(function($) {
	
	$.fn.jwNotice = function(options) {

		var options = $.extend({
			className : 'notice',
			text : null,
			siteWidth : null
		}, options);
	
		return this.each(function() {
			
			$(this).prepend('<div class="' + options.className + '" />');

			var $announceDiv = $('.' + options.className);			

			$announceDiv
			   .append('<div>' + options.text + '</div>')
			   .children('> div')
			      .css({
				   'width' : options.siteWidth,
				   'margin' : 'auto'
			   })
			   .end()
			   .prepend('<span class="close">X</span>')
			   .children('.close')
			        .css({
						'position' : 'absolute',
						'cursor' : 'pointer',
						'display' : 'none'
					})
				.end()
				
			   .hover(function() {
					// over
					$(this)
					   .children('span.close')
					   .show()
					   .click(function() {
						    $announceDiv.slideUp(250, function() {
							$(this).remove();
						});
					});
				
				}, function() {
					// out
					$('.close').hide();
				});
		
		}); // end each
		
	}
	
})(jQuery);

Initial URL

                                

Initial Description

                                

Initial Title
jwAnnounce - jQuery Plugin

Initial Tags
plugin, jquery

Initial Language
jQuery