Passing an array of hyperlinks in jquery

I am creating a flowchart using jquery and html that has nodes (circles) and arrows that connect these circles. Two actions must be performed, one of which is the tooltip action, which will show specific text when u hover over a specific circle. And another function is that whenever we click on these circles, another html page displays AKA hyperlinks. I have 18 circles and I created the desired 18 HTML pages. BUt m stuck in a hyperlink. I don’t know how to pass these hyperlinks to my jQuery plugin. Below is the code for the tooltip function

    function oncanvasmousemove(evt) {
    clearTimeout(timer);

    lastTimeMouseMoved = new Date().getTime();

    timer = setTimeout(function () {
        var currentTime = new Date().getTime();

        if (currentTime - lastTimeMouseMoved > 300) {
            var mousePos = getMousePos(canvas, evt);
            var tC, isMatched = false;

            for (c = 0; c < circles.length; c++) {
                tC = circles[c];
                if (mousePos.DistanceTo(tC.centerX, tC.centerY) < tC.Radius + 5) {
                    isMatched = true;
                    break;
                }
            }

            if (isMatched === true) {
                $("#tooltip").html(tC.Text).css({
                    'top': mousePos.Y + canvasoffset.top - 40,
                    'left': mousePos.X + canvasoffset.left - $("#tooltip").width() / 2
                }).show();
            } else {
                $("#tooltip").hide();
            }
        }
    }, 300);
}

I am attaching a page image enter image description here

+4
1

CSS.

"# -1", "# -2"... "# -18".

CSS . ".circle-link".

//On clicking anything with the circle-link class...
$('.circle-link').click(function() {

    var link_id = $(this).attr("id"); //Get ID of circle that was clicked

    //Get ID number
    link_id = link_id.split("-"); //Split the string on the dash/hyphen (returns array)
    link_id = link_id[2]; //Get second array element (should be the number)

    //Use the above number to determine which link to call

});
+1

Source: https://habr.com/ru/post/1547114/


All Articles