JSFiddle - React, Tailwind, and code Playground

by drublic

JavaScript

var $mainContent = $("#content"),
    siteUrl = "http://" + top.location.host.toString(),
        url = ''; 

$(document).on("click", "a[href^='"+siteUrl+"']:not([href^='#']):not([href*='/wp-admin/']):not([href*='/wp-login.php']):not([href$='/feed/'])", function() {
    $(this).attr("href", "#" + this.pathname);
    
    $mainContent.animate({opacity: "0.1"});
    
    url = $(this).attr("href").substring(1);
    url = url + " #ajax-content";
    
    $mainContent.load(url, function() {
        $mainContent.animate({opacity: "1"});
    });
});