Last active
September 23, 2019 09:41
-
-
Save lisacatalano/21d4e621f25e047669b7 to your computer and use it in GitHub Desktop.
JavaScript for main.js
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
(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