JSFiddle - React, Tailwind, and code Playground

by lshettyl

JavaScript

$(document).ready(function() {
    console.log("Executing embedded jQuery.")
    if (document.location.hash.length <= 0) {
        $("#home").length && $("#home").trigger("click");
        console.log("Simulating #home link click.");
    } else {
        $(document.location.hash).length && $(document.location.hash).trigger("click");
        console.log("Simulating " + document.location.hash + " link click.");
    }

    $("#header #nav a").click(function() {
        console.log("clicked on: " + this.id);
        if (!$(this).hasClass("active")) {
            $("#nav a").removeClass("active");
            $(this).addClass("active");
            var ID = this.id;

            switch (ID) {
                case "home":
                    $.get("{text:DocumentRoot}index.html", function(data) {
                        $("#iframe").html(data);
                    });
                break;
                case "showcase":
                case "about":
                case "github":
                    $.get("{text:DocumentRoot}" + ID + ".html", function(data) {
                        $("#iframe").html(data);
                    });
                break;
                default:
                    event.preventDefault();
                break;
            }
        }
    });
});