bootstrap-slider icon indicating copy to clipboard operation
bootstrap-slider copied to clipboard

Change rollover element that fires tooltip

Open tayden opened this issue 10 years ago • 12 comments
trafficstars

It would be nice if the tool-tip event was only fired when hovering over the slider bar or handles and not when hovering over the location where the tooltip shows up. This is causing the tool-tip to open when I'm trying to select other controls that are placed above the slider.

tayden avatar Jan 21 '15 23:01 tayden

Having the same issue. The tooltip appears when I am trying to choose values in a multi select positioned above the slider.

richdykins avatar Jan 22 '15 15:01 richdykins

I have this issue as well. Maybe someday I can contribute a PR, but the bulk of my project is in Clojure, and I am pulling in just enough Javascript to create a basic web interface, so I hope someone else may be able to do so before me—I have no idea where to even begin researching this issue.

As an aside, I love what this slider has given me in terms of features and appearance.

brunchboy avatar Feb 03 '16 23:02 brunchboy

Ok, after confirming that other tooltips in Bootstrap don’t behave this way, I couldn’t help looking a little bit at the source, and I think I understand the problem: The tooltip is created as part of the sliderElem, and when the tooltip-related event handlers are being set up, that whole sliderElem has mouseenter and mouseleave event handlers bound to it to show and hide the tooltip. So to fix it, the tooltip should be kept separate from the sliderElem structure, and inserted separately into the document. I am not sure what else that might break, however; for example, is there code to remove the slider? If so it would need to be updated to remove both the slider and the tooltip which have become separate entities.

brunchboy avatar Feb 04 '16 00:02 brunchboy

+1.

You'd only want the tooltip to show when dragging and / or hovering the slider, not when hovering the area that the slider tooltip itself occupies. Real annoying with multiple sliders next to each other

andreaslarssen avatar May 10 '16 14:05 andreaslarssen

I gave up on trying to fix this, since CSS and Javascript are not my core areas of expertise, and just had to disable the tooltips entirely.

brunchboy avatar May 10 '16 14:05 brunchboy

👍 This is definitely required!!

For now, I am just using a workaround with z-indexes, example:

/* for element above/below/left/right of the slider, give a higher z-index */
.element-above {
    z-index: 2;
    margin-bottom: 10px;   /* Modify this depending upon design, and whether tooltip overflows, see comment below */
}
/* Also make sure that there is enough space between the two, so that the z-index workaround works! i.e the tooltip has some padding, and if the tooltip overflows this "element-above", then it will seem that the workaround doesn't work */

/* reduce the default tooltip z-index (but only for bootstrap-slider,
so use a container elements class) */
.give-the-container-a-class .tooltip {
    z-index: 1;
}

/* increase the default tooltip z-index when the tooltip is shown,
i.e has the "in" class */
.give-the-container-a-class .tooltip.in {
    z-index: 3;
}

@brunchboy try this!

I will look at the source if time permits...

bool-dev avatar Aug 12 '16 13:08 bool-dev

we would greatly welcome a PR that addresses this! thanks!

rovolution avatar Aug 12 '16 14:08 rovolution

I am traveling internationally at the moment but will try your suggestion when I return, thanks!

brunchboy avatar Aug 12 '16 14:08 brunchboy

Any news on this?

andreaslarssen avatar Oct 11 '16 08:10 andreaslarssen

@bool-dev: Can I ask you how your html's looking?

andreaslarssen avatar Oct 11 '16 09:10 andreaslarssen

@andreaslarssen hey, was pretty busy with stuff, missed your comment, sorry! I have created a fiddle for the workaround, check: https://jsfiddle.net/bool_dev/99qfx8ey/

Remember that there should be enough space between the elements, for the workaround to work.

bool-dev avatar Nov 16 '16 13:11 bool-dev

Hi, @bool-dev . No sweat. Thanks for sharing.

andreaslarssen avatar Nov 16 '16 14:11 andreaslarssen