Skip to main content
- /*! Version 1.1 */
-
- //On Load Scripts
- $(function() {
-
- //Code View Functionality
- $('.code-view').click(function(){
- $('body').addClass('code');
- $('.site, .site-view').on('click.codeview',function(){
- return false;
- });
- return false;
- });
- $('.code-view').hover(function(){
- $('body').toggleClass('peek');
- });
- $('.site').hover(function(){
- $('body.code').toggleClass('rev-peek');
- });
- $('.site, .site-view').click(function(){
- $('body.code').removeClass('code rev-peek');
- $('.site, .site-view').off('click.codeview');
- })
- $('.navbar-nav li a').click(function(){
- $('body.code').removeClass('code rev-peek');
- $('.site, .site-view').off('click.codeview');
- })
-
- //Close the nav when it is clicked
- $(function(){
- var navMain = $(".navbar-collapse");
- navMain.on("click", "a:not([data-toggle])", null, function () {
- navMain.collapse('hide');
- });
- });
-
- //Modal initialization
- $('#site-mod').heliumModal({
- vert: 50, // Vertical position by percentage.
- speed: 500, // Speed for animations
- easing: 'swing', // Easing style for animations. use standard jquery easing options.
- onOpen: function(){ }, // callback before modal opens
- afterOpen: function(){ },// callback after modal opens
- onClose: function(){ }, // callback before modal closes
- afterClose: function(){ }// callback after modal closes
- });
-
- //Modal content population
- $('.mod-link').click(function(event){
- if($(window).width() > 992){
- event.preventDefault();
- var modHTML = $(this).html();
- var modLink = $(this).attr('href');
- $('#site-mod .content').html(modHTML);
- if(!$('body.code').length){
- $('#site-mod').heliumModal('openModal');
- }
- }
- });
-
- //Code View Parallax Effect
- function scrollIt(scrollElement){
- $(window).scroll(function(){
- var scrollEnd = scrollElement.outerHeight() - $(window).innerHeight();
- var pageEnd = $(document).height() - $(window).innerHeight();
- var currScroll = $(window).scrollTop();
- var currRatio = (currScroll / pageEnd);
- var newVal = scrollEnd * currRatio;
- scrollElement.css('transform','translate(0,-'+newVal+'px)');
- });
- }
-
- // Load Code View Content
- $('#parallax-css').load('../code-css.php .prettyprint', function(event){
- $('#parallax-css pre').removeClass('mobile-code');
- runPrettyPrint();
- scrollIt($('#parallax-css pre'));
- });
- $('#parallax-html').load('../code-html.php .prettyprint', function(event){
- $('#parallax-html pre').removeClass('mobile-code');
- runPrettyPrint();
- scrollIt($('#parallax-html pre'));
- });
- $('#parallax-js').load('../code-js.php .prettyprint', function(event){
- $('#parallax-js pre').removeClass('mobile-code');
- runPrettyPrint();
- scrollIt($('#parallax-js pre'));
- });
-
- //CSS-JS Toggle
- $('.code-toggle').click(function(){
- $('#parallax-css, #parallax-js').toggle();
- if($('#parallax-css:visible').length){
- $('.code-toggle span').html('JS');
- } else {
- $('.code-toggle span').html('SCSS');
- }
- return false;
- });
-
- }); // End Document Ready
-
- //Re-initialze prettyprint
- function runPrettyPrint(){
- PR.prettyPrint();
- }
-