src/js/main.js
// Expand tile when project's link is clicked
Expand tile when project's link is clicked
Expand tile when project ' s link is clicked
function projectLinkClickHandler(e) {
        var $this = $(this);
        var $activeLink = $projectLinks.filter('.' + activeClass);
        var $activeTile = $projectTiles.filter('.' + activeClass);
        var linkIndex = $projectLinks.index($this);
        if ($activeTile.length > 0) {
            $activeLink.removeClass(activeClass);
            $activeTile.removeClass(activeClass);
            if (linkIndex !== $projectTiles.index($activeTile)) {
                setTimeout(function() {
                    $this.addClass(activeClass);
                    $projectTiles.eq(linkIndex).addClass(activeClass);
                }, 350);
            }
        } else {
            $this.addClass(activeClass);
            $projectTiles.eq(linkIndex).addClass(activeClass);
        }
        e.preventDefault();
    }
function projectLinkClickHandler ( e ) { var $this = $ ( this ) ; var $activeLink = $projectLinks . filter ( '.' + activeClass ) ; var $activeTile = $projectTiles . filter ( '.' + activeClass ) ; var linkIndex = $projectLinks . index ( $this ) ; if ( $activeTile . length > 0 ) { $activeLink . removeClass ( activeClass ) ; $activeTile . removeClass ( activeClass ) ; if ( linkIndex !== $projectTiles . index ( $activeTile ) ) { setTimeout ( function ( ) { $this . addClass ( activeClass ) ; $projectTiles . eq ( linkIndex ) . addClass ( activeClass ) ; } , 350 ) ; } } else { $this . addClass ( activeClass ) ; $projectTiles . eq ( linkIndex ) . addClass ( activeClass ) ; } e . preventDefault ( ) ; }
Expand tile when project's link is clicked
Expand tile when project ' s link is clicked
// If a tile is currently active, it must be deactivated // Deactivate the active tile // If the clicked link does not belong to the previously-active // tile, activate the tile associated with the clicked link // Otherwise, just activate the desired tile // Prevent the link from being followed