jquery / jquery/jquery-ui

jquery ui position with offsets not working

Open
#2,087 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Behavior shared with 1.12 Bug Comp: Position
Dominant language
JavaScript
Stars
11.3k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

Positioning with offset not working.

Example:
CSS:
#targetElement {
height:300px;
margin: 20px;
border: dashed 1px #ee4455;
background: #9cf;
}
.positionDiv {
position: absolute;
width: 75px;
height: 75px;
background: rgba(255,255,255,.3);
border: dashed 1px #ee4455;
}

HTML:
<div id="targetElement">
2 and 3 should be at the same position relative to 1
<div class="positionDiv" id="position1">1</div>
<div class="positionDiv" id="position2">2</div>
<div class="positionDiv" id="position3">3</div>
</div>

JS:
$( "#position1" ).position({ my: "center", at: "center", of: "#targetElement" });
$( "#position2" ).position({ my: "left+50% top+50%", at: "left+100% top", of: "#position1" });
$( "#position3" ).position({ my: "center center", at: "right top", of: "#position1" });

#position2 and #position3 should be at the same position relative to #position1
I know that left+50% = center but what if i want to use a different offset .

you can see the example in this fiddle

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the positioning examples in the linked JSFiddle and compare the results for #position2 and #position3. Trace the jQuery UI position behavior used by these calls; done means percentage and custom offsets produce the intended relative placement and the reported case is covered by a verified result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.