Last active
December 31, 2015 02:39
-
-
Save colintoh/7922113 to your computer and use it in GitHub Desktop.
Refactor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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