Skip to content

Instantly share code, notes, and snippets.

@lisacatalano
Last active September 23, 2019 09:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lisacatalano/21d4e621f25e047669b7 to your computer and use it in GitHub Desktop.
Save lisacatalano/21d4e621f25e047669b7 to your computer and use it in GitHub Desktop.
JavaScript for main.js
(function ($) {
// Hide all shortcuts and notes
var hideAll = function() {
$('.shortcuts').hide();
$('.notes').hide();
};
// animate the platform buttons when user chooses one before taking them page.
$('.platform').on('click', function(e) {
var url = this.href;
var $target = $(this).parent();
e.preventDefault();
$target.addClass('active').siblings().hide();
$target.animate({
width: '90%',
height: '500px',
opacity: 0
}, 1000, function() {
window.location = url;
});
});
// toggle display of shortcuts when clicking on header
$('h2').on('click keypress', function(){
$(this).parent().find('.shortcuts, .notes').slideToggle();
});
hideAll();
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment