tether icon indicating copy to clipboard operation
tether copied to clipboard

attachment: 'top right' only has the right position after first onResize()

Open pubkey opened this issue 8 years ago • 3 comments

I created a tether between 2 elements with the following js:

new Tether({
  element: '#a1234',
  target: '#target',
  attachment: 'top right',
  targetAttachment: 'top left'
});

When the tether is created, the #a1234 is located to far left of the #target. But the moment I resize the window, the position gets fixed.

JS-Fiddle to reproduce.

Tested on Chrome and Firefox.

pubkey avatar Jan 10 '17 10:01 pubkey

That's very strange. I have no idea where that initial transformX value is coming from. 😕

TrevorBurnham avatar Jan 11 '17 17:01 TrevorBurnham

This is happening for me as well, only with a different combination of settings (attachment: 'bottom right', targetAttachment: 'bottom left'). I called position() on the tether object after I created it and it fixed the issue for now.

JSFiddle

bgoerdt avatar Feb 01 '17 00:02 bgoerdt

I've encountered the same problem. I have some code that resizes panels responsively, and I've found, strangely, that tether only works if I duplicate the code above and below the responsive code.

geotheory avatar Jan 07 '18 00:01 geotheory

This is still happening.

Trying to tether a menu with the settings

new Tether({
    element: menuEl.value,
    target: selfEl.value,
    attachment: 'top right',
    targetAttachment: 'bottom right',
    offset: '-5px 0',
    constraints: [{
        to: 'body'
    }]
})

will render like this image

Resizing the window seems to trigger positioning to the right, however the positioning is a bit haphazard.

image

cleverplatypus avatar Jun 21 '23 04:06 cleverplatypus