Skip to content

Instantly share code, notes, and snippets.

@colintoh
Last active December 31, 2015 02:39
Show Gist options
  • Save colintoh/7922113 to your computer and use it in GitHub Desktop.
Save colintoh/7922113 to your computer and use it in GitHub Desktop.
Refactor
//Call bindEvents in the init()
function bindEvents(){
var $container = $('.container');
$container.on('click','#button--solve',buttonSolveCallback);
$container.on('click','.instruction_close',function(){ $("#blackout-4").fadeOut(); });
$container.on('click','#button--close',function(){ $('#blackout_1').hide(); });
}
//I refactor out the callBack for events. You can rename them as xxxxCallback for the rest of the events callbacks for consistency.
function buttonSolveCallback(){
omiture.call("|game|solvepuzzle", ":game:solvepuzzle", ":game:solvepuzzle", ":game:solvepuzzle");
$('#blackout_1').show();
$('html,body').animate({
scrollTop: '0px'
},"slow");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment