Return to Snippet

Revision: 37681
at July 12, 2011 08:52 by jeremytarpley


Updated Code
// load scripts by assigning a label for them
	head.js(
	   {jquery: "http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"},
	   {custom: "<?php echo get_bloginfo(template_url); ?>/include/js/main.js"}
	);
    
	//call this function as soon as jquery is ready
	head.ready("jquery", function(){
	    //fade in the background
	    jQuery('#pageBackground').fadeIn('1500');
	    jQuery('section').delay('900').fadeIn('1500');
	    
	    //resize background script from example at http://css-tricks.com/perfect-full-page-background-image/
	    var theWindow        = $(window),
		$bg              = $("#pageBackground"),
		aspectRatio      = $bg.width() / $bg.height();
	    function resizeBg() {
		if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
		    $bg
			.removeClass()
			.addClass('bgheight');
		} else {
		    $bg
			.removeClass()
			.addClass('bgwidth');
		}
	    }
	    theWindow.resize(function() {
		resizeBg();
	    }).trigger("resize");
	});
	
	//google stats
	head.js("http://www.google-analytics.com/ga.js", function() {
	    var tracker = _gat._getTracker("UA-XXXXXX-X");
	    tracker._trackPageview();
	});

Revision: 37680
at December 15, 2010 06:07 by jeremytarpley


Initial Code
// load scripts by assigning a label for them
	head.js(
	   {jquery: "http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"},
	   {custom: "<?php echo get_bloginfo(template_url); ?>/include/js/main.js"}
	);
    
	//call this function as soon as jquery is ready
	head.ready("jquery", function(){
	    //fade in the background
	    jQuery('#pageBackground').fadeIn('1500');
	    jQuery('section').delay('900').fadeIn('1500');
	    
	    //resize background script from example at http://css-tricks.com/perfect-full-page-background-image/
	    var theWindow        = $(window),
		$bg              = $("#pageBackground"),
		aspectRatio      = $bg.width() / $bg.height();
	    function resizeBg() {
		if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
		    $bg
			.removeClass()
			.addClass('bgheight');
		} else {
		    $bg
			.removeClass()
			.addClass('bgwidth');
		}
	    }
	    theWindow.resize(function() {
		resizeBg();
	    }).trigger("resize");
	});
	
	//google stats
	head.js("http://www.google-analytics.com/ga.js", function() {
	    var tracker = _gat._getTracker("UA-254185-2");
	    tracker._trackPageview();
	});

Initial URL


Initial Description
Trying out head.js - available at http://headjs.com/

Initial Title
Trying out head.js - after

Initial Tags


Initial Language
JavaScript