Learn how to use jQuery at the Blog

Artisan Built « visit

  • Added 9 months ago
  • 69 Lines of Code shown
  • 0 Links of Interest
http://artisanbuilt.net
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 Artisan Built - http://artisanbuilt.net

$(document).ready(function() {
	$("body").prepend("<div id=\"body_wrap\"><\/div>");
	$("#body_wrap").css({"background":"#211102"});
});
$(window).load(function(){
	$("#body_wrap").fadeOut(1000);
});




document.write("<style type='text/css'>.property_photo{display:none} #property_display{height:403px}</style>");
$(function(){
	if ($('#body_homes').length > 0) {
		var photoList = $('.property_photo');
		$('#property_display').prepend("<img src=" + $('.property_photo:eq(0)').attr("href") + " alt='' /><p><a href='#' id='previous'>Previous Photo</a> | <a href='#' id='next'>Next Photo</a> &gt; <span id='counter'>1</span>/" + photoList.length + " &gt; <span id='title'>" + $('.property_photo:eq(0)').text() + "</span></p>");

		function changePhoto(counter){
			$("#property_display img").attr("src", $('.property_photo:eq('+counter+')').attr("href"));
			$("#title").html($('.property_photo:eq('+counter+')').text());
			$("#counter").html(counter + 1);
		}

		var counter = 0;
		$('#next').live('click', function(){
			counter++;
			if (counter >= photoList.length) {counter = 0;}
			changePhoto(counter);
			return false;
		});
		$('#previous').live('click', function(){
			counter--;
			if (counter < 0) {counter = photoList.length - 1;}
			changePhoto(counter);
			return false;
		});
		
		$(window).load(function(){
			$('.property_photo').each(function(){
				var src = this.href;
				$("<img />").attr("src", src);
			});
		});
	}
	
	$("#header a[id!='nav_contact']").each(function(){
		var top = $(this).css("top");
		$(this).css({"opacity":0, "background":"url(images/bg_nav.png) 0 0 no-repeat", "background-position":"-180px -"+top}).hover(function(){$(this).stop().fadeTo(300, 1)}, function(){$(this).stop().fadeTo(300, 0)});
	});

	$("#nav_contact").css({"opacity":0, "background":"url(images/bg_nav_contact.png) 0 0 no-repeat"}).hover(function(){$(this).stop().fadeTo(300, 1)}, function(){$(this).stop().fadeTo(300, 0)});


	//CONTACT
    $("input[name='submit']").live('click', function() {
		$('#form_status').fadeOut(500, function(){
			$('#form_working').fadeIn(500, function () {
	            $.post('_contact.inc.php', {'update':'update', 'name': $("input[name='name']").val(), 'email' : $("input[name='email']").val(), 'subject' : $("input[name='subject']").val(), 'message' : $("textarea[name='message']").val(), 'submit' : 'submit'}, 
	            function(data){
					$('#form_working').fadeOut(500, function(){
						$('#contact_form').html(data);
						$('#form_status').fadeIn(500);
					});
	            }, "html");
			});
		});
        return false;
    });
});