Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3794432
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:55:43+00:00 2026-05-19T12:55:43+00:00

I’ve begun development on a web app, and I’m just now tackling some of

  • 0

I’ve begun development on a web app, and I’m just now tackling some of the first front-end obstacles. I’ll give you some details about the front-end first, just to make sure the context of my question is clear.

**Below is a diagram, showing the different elements relevant to the question.*
enter image description here

Each Node is draggable. If you would , please take a quick look at http://labs.inversepenguin.com to view a test canvas with one node active.

Diagram notes:

Node 2 ‘s position in Figure 2 has changed from it’s location in Figure 1, resulting in an extra link being displayed. My goal is to have the newly created link appear the instant node2 has been dragged the necessary distance… as opposed to say, after the user drops node2.


“How can I create a Javascript/Jquery algorithmic function that will calculate on load–and re-draw during mousedrag?”


The desired function would consist of:

  • An algorithm to analyze the distance
    between nodes to determine how many
    links should be displayed.

  • Create/destroy links based upon results.

  • To position each resulting link appropriately; centered and evenly
    spaced.

I’m confident in my geometry and math abilities to handle the execution of the function–but I’m not sure how to make the function “listen” and “re-draw” during mousedrag.


I was maybe thinking maybe having the function call itself at it’s end, after an if checking to see if the user is “still dragging,” but I’m new to programming and don’t have a firm grasp on what’s practical.

Thanks in advance for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:55:44+00:00Added an answer on May 19, 2026 at 12:55 pm

    If you use Jquery UI for your dragging, you could define the start, drag, or stop events to do the appropriate work.

    $( ".selector" ).bind( "dragstart", function(event, ui) {
      ...
    });
    
    $( ".selector" ).bind( "drag", function(event, ui) {
      ...
    });
    
    $( ".selector" ).bind( "dragstop", function(event, ui) {
      ...
    });
    

    The challenge I see is that each node will have to know what is connected to it. I have done this before by creating my own attributes. Using your 2 node solution above:

    <div id="node1" child="node2" />
    <div id="node2" parent="node1" />
    

    If you have nodes linked to multiple other nodes, you could just do something like

    <div id="node1" children="node2;node3;node4" />
    

    with a delimited list of children. Then retrieving this information for your processing would be as simple as var children = $(this).attr('children').split(';'); and that will get you an array of the children’s id’s. You can also get the position of the element and the children, calculate the distance, and modify your links.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.