User:Grrrreat/prototyping/pokingsite

From XPUB & Lens-Based wiki
< User:Grrrreat
Revision as of 10:03, 10 May 2012 by Grrrreat (talk | contribs) (Created page with "<pre> function reposition(){ var counter = jQuery(".counter"); var pokebutton = jQuery("#pokebuttonsubmit"); var position = pokebutton.offset(); jQuery(".counter").css({'po...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
function reposition(){
	var counter = jQuery(".counter");
	var pokebutton = jQuery("#pokebuttonsubmit");
		var position = pokebutton.offset();
		jQuery(".counter").css({'position':'absolute','left':position.left + pokebutton.outerWidth() - 10});
}

function hideAbout(){
	$('#description').fadeOut(700, function(){ });
}
function countDown(number){
	$('#btnText').html(number);	   	
	if(number>0){
		var t=setTimeout("countDown("+(number-1)+")",1000);
	}else{
		$('#btnText').html('Poke Me');
		$('.pokebutton').removeClass('disabledButton');
		$('.buttonshadow').css('background-image', 'url(../img/buttonshadow.png)');
		pokerEnabled = true;
		reposition();
	}
}
img1 = new Image();
img1.src = "../img/buttonshadow-smaller.png";
    
var pokerEnabled = true;
jQuery(document).ready(function() {
	reposition();
	
	jQuery(window).resize(function() {
  reposition();
});
	
	$(".what").bind("click", function(){
		$('#description').fadeIn(200, function(){ });
		var aboutTimeout=setTimeout("hideAbout()",30000);
	});

	$("#close").bind("click", function(){
		hideAbout();
		clearTimeout(aboutTimeout);
	});
			  
	$.get("count.php", function(data){
		$('#totalnumber').html(data); 
	}, "json");
  
	$('#pokebuttonsubmit').click(function(event) {
		event.preventDefault();
		if(pokerEnabled){
			$.get("poke.php");
			$.get("count.php", function(data){
			     $('#totalnumber').html(data);
			}, "json");
			$('.pokebutton').addClass('disabledButton');
			countDown(9);
			$('.buttonshadow').css('background-image', 'url(../img/buttonshadow-smaller.png)');
			reposition();
		}
		pokerEnabled = false;
	});
	

	   

});