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 7507127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:25:32+00:00 2026-05-29T22:25:32+00:00

Can d3.js layout.force be used to (re)position non-svg elements like div’s? If div’s have

  • 0

Can d3.js layout.force be used to (re)position non-svg elements like div’s?

If div’s have position: absolute; maybe left and top could be used as a equivalent for the x1 and y1 attributes as used for the svg elements?

The goal is to have some force effects on images and menu items with IE8 support. I’m aware of the fact that svg nodes can be images but as I need to support IE8 this is not an option.

If not possible, is using svgweb together with d3.js a stable option for this purpose?

Thanks!

**Update**

D3 is cool!! I’m starting to get the hang of it and it sure is possible to use “the force” on regular html elements like divs as d3.layout.force() essentially gives you x and y coordinates for every “tick” (or frame) which you can use however you want.
ie:

force.nodes(data)
     .on("tick", tick)
     .start();

function tick() {
     div.style("left", function(d) {return d.x+"px"})
        .style("top", function(d) {return d.y+"px"});
}

works just fine!

dragging with .call(force.drag); does give you problems (as expected).

firebug:

(container.ownerSVGElement || container).createSVGPoint is not a function
d3_svg_mousePoint()d3.js (line 3718)
container = div#nav
e = mousemove clientX=607, clientY=200
mouse()d3.js (line 3711)
container = div#nav
d3_behavior_dragPoint()d3.js (line 4481)
d3_behavior_dragDispatch()d3.js (line 4453)
type = "drag"
d3_behavior_dragMove()d3.js (line 4491)
l()d3.js (line 1871)
e = mousemove clientX=607, clientY=200
[Break On This Error]   

var point = (container.ownerSVGElement || container).createSVGPoint();

Should be fixable though.

  • 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-29T22:25:33+00:00Added an answer on May 29, 2026 at 10:25 pm

    In principle there is nothing SVG-specific in D3. You will have to see if it works in practice for your particular application, but it certainly sounds feasible. Have a look in particular at the documentation for force.layout.on, which has an example showing how to update node and link positions. If you change that code to modify the relevant position attributes of the div, it should work.

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

Sidebar

Related Questions

In the layout you can set the EditText widget to be non-editable via the
I have a basic layout where different components can be selected using a tree
I have the following in a layout file; <?php $Filename = TheEvent.vcs; header(Content-Type: application/force-download);
I have a dojox.layout.FloatingPane (as a custom dijit) which can be positioned anywhere within
I have a GTK layout with a widget on the left of an HBox
I have an xml layout that compiles fine but when I used the intent
Is there any way I can force a floated div to shrink instead of
If we make fluid layout we can use em or % for font and
The users of my app can configure the layout of certain files via a
I am trying to put a layout together with jquery-ui-layout and can't overcome the

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.