JSFiddle - React, Tailwind, and code Playground

by fparent

JavaScript

var $sections     = $( '.section' );

// Bind the waypoints on the different sections to make sure we
// update the URL when scrolling the page
$sections.waypoint( function( dir ) {
    var $this = $( this );
    var id = '/';
    
    if ( !$this.hasClass('hero') ) {
        id = '#' + $this.attr( 'id' );
    } else {
        id = '/';
    }
    
    UTIL._updateMarker( id );
    UTIL._updateURL( id );
},
                   {
                       continuous: false
                   });


$menus.on( 'click', function( e ) {
        var $this = $( this );
        var sectionName = $this.attr( 'href' );
        var $target = $sections.filter( sectionName );

        e.preventDefault();

        // Scroll the page to the selected section
        UTIL._updateMarker( sectionName );
        UTIL.scrollToSection( $target );
      });