JSFiddle - React, Tailwind, and code Playground

by charlescarver

JavaScript

function doAjax(url) {
    $("#info").click(function() {
        $(".info").css("display", "block");
        setTimeout(function() {
            $(".info").addClass("visible");
        }, 1);
    });
    $(".info").click(function() {
        $(".info").removeClass("visible");
        $(".info").addClass("hidden");
        setTimeout(function() {
            $(".info").css("display", "none");
        }, 300);
    });
    setFavorite();

    function setFavorite() {
        var threshold = {
            x: 30,
            y: 10
        };
        var originalCoord = {
            x: 0,
            y: 0
        };
        var finalCoord = {
            x: 0,
            y: 0
        };

        function touchMove(event) {
            console.log(event.originalEvent.targetTouches);
            finalCoord.x = event.targetTouches[0].pageX;
            changeX = originalCoord.x - finalCoord.x;
            var changeY = originalCoord.y - finalCoord.y;
            if (changeY < threshold.y && changeY > (threshold.y * -1)) {
                changeX = originalCoord.x - finalCoord.x;
                if (changeX > threshold.x) {
                    window.removeEventListener('touchmove', touchMove, false);
                    if ($(event.target).attr("class") === "row-inside") {
                        var element = $(event.target);
                    }
                    if ($(event.target).attr("class") === "row-l") {
                        var element = $(event.target).parent();
                    }
                    if ($(event.target).attr("class") === "row-r") {
                        var element = $(event.target).parent();
                    }
                    var text = $(element).find(".row-l").text();
                    var favstatus = $(element).find(".row-r").text();
                    var thisStar = $(element).parent().find(".star-inside");
                    $(element).css("margin-left", "-75px");
                    if...