Skip to content
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

Detect viewport edges with tooltips, popovers, and dropdowns #3637

Closed
marcalj opened this issue May 30, 2012 · 18 comments
Closed

Detect viewport edges with tooltips, popovers, and dropdowns #3637

marcalj opened this issue May 30, 2012 · 18 comments

Comments

@marcalj
Copy link

marcalj commented May 30, 2012

Hi, take a look at this tooltips plugin:
http://osvaldas.info/blog/elegant-css-and-jquery-tooltip-responsive-mobile-friendly

It works perfect positioning tooltips on window borders, not like Twitter Bootstrap!

I'm not sure if it's a CSS or JS issue.

@mdo
Copy link
Member

mdo commented Jun 3, 2012

I've long wanted improved viewport edge detection. Unsure if we have this particular aspect file already. @fat, take a look when you can please?

@keilmillerjr
Copy link

+1

@fat
Copy link
Member

fat commented Jul 22, 2012

Hey @marcalj,

Thanks for opening this issue! Unfotunately, it looks like it fails to pass the tests neccessary for submitting to bootstrap. The following tests are currently failing:

  • should include a jsfiddle/jsbin illustrating the problem if tagged with js but not a feature

For a full list of issue filing guidelines, please refer to the bootstrap issue filing guidelines.

thanks!

@fat fat closed this as completed Jul 22, 2012
@richardp-au
Copy link

@fat I think your script needs a little tweaking. Not everything needs a jsFiddle or maybe this should be tagged as a feature instead.

@fat
Copy link
Member

fat commented Jul 24, 2012

yep, should be a feature

@fat fat reopened this Jul 24, 2012
@mdo
Copy link
Member

mdo commented Aug 19, 2012

Renamed issue to ensure we snag all the applicable components in one pass as this extends beyond tooltips.

@meh
Copy link

meh commented Aug 19, 2012

Any update/ETA on this?

@rafalp
Copy link

rafalp commented Oct 2, 2012

+1 for this

@nickpresta
Copy link

@fat @markdotto any word on this and related issues?

#3637
#3614

An example of this can be seen here: http://twitter.github.com/bootstrap/components.html#dropdowns (hover over the More Options under the submenu section - it renders off the page).

Thank you.

@willit0
Copy link

willit0 commented Oct 28, 2012

This issue have been there for long time. I was able to fix it with the following code

$(".dropdown-toggle").click(function(e) {
    var menu = $(this).next('.dropdown-menu'),
        mousex = e.pageX + 20, //Get X coodrinates
        mousey = e.pageY + 20, //Get Y coordinates
        menuWidth = menu.width(), //Find width of tooltip
        menuHeight = menu.height(), //Find height of tooltip
        menuVisX = $(window).width() - (mousex + menuWidth), //Distance of element from the right edge of viewport
        menuVisY = $(window).height() - (mousey + menuHeight); //Distance of element from the bottom of viewport

    if (menuVisX < 20) { //If tooltip exceeds the X coordinate of viewport
        menu.css({'left': '-89px'});
    } if (menuVisY < 20) { //If tooltip exceeds the Y coordinate of viewport
        menu.css({
            'top': 'auto',
            'bottom': '100%',
        });
    }
});

I'm not sure how this work, but it's not working on my ipad or mobile.

@andrejbranch
Copy link

👍 @willit0

@fat
Copy link
Member

fat commented Dec 20, 2012

Going to pass over to @mdo – need the nw, ne, sw, se, css styles first… then i'll whip up some js real quick

@smajl
Copy link

smajl commented Jan 3, 2013

Really looking forward to see this implemented! :) +1 for this

@akhanubis
Copy link

+1 for this!

@mdo
Copy link
Member

mdo commented Feb 6, 2013

Closing as a dupe of #6713 which has been merged into #6346.

@mdo mdo closed this as completed Feb 6, 2013
@lieut-data
Copy link

I could be mistaken, but in the dupe and merge shuffle, I think the original request to take viewports into account when displaying dropdowns was lost.

@cvrebert
Copy link
Collaborator

@lieut-data: I'd advise filing a new issue specifically for dropdowns.

@sloveall
Copy link

sloveall commented May 8, 2013

There's a nice solution for popovers here:
http://stackoverflow.com/questions/9956958/changing-the-position-of-bootstrap-popovers-based-on-the-popovers-x-position-in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests