-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Element renders off-screen for mobile #170
Comments
Bump |
It's been nearly a year since #100 and about 3 years since #16. Do you know if hubspot has abandoned this lib @geekjuice? Edit: In the meantime, @streamside posted this in #16 - I've just tested and it seems to work great (after editing it slightly): // Create the drop and register subscription to open event
let drop = new Drop(options);
drop.on('open', function() { positionDrop(drop); });
// Ensures drop is horizontally within viewport (vertical is already solved by drop.js).
function positionDrop(drop) {
var rect = drop.drop.getBoundingClientRect();
if(rect.left >= 0 && rect.right <= window.innerWidth) { return; }
var dropWidth = drop.drop.getBoundingClientRect().width,
left = drop.target.getBoundingClientRect().left,
right = window.innerWidth - left,
direction = dropWidth > right ? 'right' : 'left';
drop.tether.attachment.left = direction;
drop.tether.targetAttachment.left = direction;
drop.position();
} (Edit) Even better:I just upgraded tether.js to 1.3.3 and drop.js to 1.4.2 and used these options:
And it seems to work really nicely (previous solution was a bit hit and miss). |
@josephrocca seeing the way they're greenkeeping I'd say yes, HubSpot has abandoned this library, at least from an OSS-support perspective. |
@josephrocca thanks, it worked:
|
When I use the drop as a tooltip in a form, it breaks when the screen is reduced to mobile screen width at 320px.
Please see the screenshot here:
Shouldn't it move to the left a little to stay within the viewport? It's currently push the page width out:
How do I fix this?
Here is the code:
The text was updated successfully, but these errors were encountered: