Learn how to use jQuery at the Blog

Brian Cray’s Blog « visit

  • Added 7 months ago
  • 105 Lines of Code shown
  • 3 Links of Interest
http://briancray.com
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Brian Cray’s Blog - http://briancray.com

(function($) {
	// $(test).animate().pause(milliseconds).animate()...
	$.fn.pause = function(milli) {
		milli = milli || 1000;
		return this.each(function () {
			$(this).queue(function() {
				var self = this;
				setTimeout(function() {
					$(self).dequeue();
				},milli);
			});
		});
	};
})(jQuery);

(function($) {
	// $('a').smoothScroll(options);
	$.fn.smoothScroll = function () {
		var options = {
			excludeClass: 'noscroll',
			speed: 300,
			easing: 'jswing',
			preventDefault: true
		};
		$.extend(options, arguments[0]);
		this.click(function(e) {
			if(this.hash == '#' || (options.excludeClass != null && $(this.hash).hasClass(options.excludeClass))) return;
			if($(this.hash).length > 0)
			{
				$.scrollTo(this.hash, options.speed, {easing: options.easing});
				if(options.preventDefault) return false;
			}
			return;
		});
	};
})(jQuery);


(function($) {
	// $('div').bigLink();
	$.fn.bigLink = function () {
		this.click(function(e) {
			var link = $(this).find('a').eq(0);
			if(link.length > 0)
			{
				window.location = link.attr('href');
			}
			e.cancelBubble = true;
		});
	};
})(jQuery);

$(function () {
	if(window.location.hash != '')
	{
		$.scrollTo(window.location.hash, 300, {easing: 'easeOutCubic'});
		$(window.location.hash).pause(300).animate({paddingLeft: '+=36'}, {duration: 500, easing: 'easeOutCirc'}).animate({paddingLeft: '-=36'}, {duration: 500, easing: 'easeOutBounce'});
	}
	
	$('.dropdown').each(function () {
		$(this).parent().eq(0).hoverIntent({
			timeout: 100,
			over: function () {
				var current = $('.dropdown:eq(0)', this);
				current.slideDown(100);
			},
			out: function () {
				var current = $('.dropdown:eq(0)', this);
				current.fadeOut(200);
			}
		});
	});
	
	$('.dropdown a').hover(function () {
		$(this).stop(true).animate({paddingLeft: '35px'}, {speed: 100, easing: 'easeOutBack'});
	}, function () {
		$(this).stop(true).animate({paddingLeft: '0'}, {speed: 100, easing: 'easeOutBounce'});
	});
	
	$('a[href*=#]').smoothScroll({easing: 'easeOutBack'});
	
	
	$('a[href^="http"]:not([href*="' + document.domain + '"])').click(function () {
		pageTracker._trackPageview('/outgoing/' + jQuery(this).attr('href'));
	});
	
	$('a.thumbnail').fancybox({
		zoomSpeedIn: 200, 
		zoomSpeedOut:	200, 
		overlayShow: false
	});
	
	$('#bio').click(function () {
		window.location = $('a', this).attr('href');
	});
});
	
pic1 = new Image(310, 672);
pic1.src = "../images/dropdown.png"; 

pic2 = new Image(4, 40);
pic2.src = "../images/dropselectionleft.png"; 

pic3 = new Image(394, 40);
pic3.src = "../images/dropselectionright.png";