Displayed outside the div element, the Bootstrap popover is extending beyond its

When using bootstrap popover, everything works fine except for the fact that when hovering outside the div area, the popup still appears. Changing the div to a button resolves this issue. Any suggestions?

If you want to see a Demo, hover outside the red div area and notice how the popover shows up.

CSS

.test {
width:100px;
height:100px;
background:red;
}

HTML

<a title="some title" class="infopop" rel="popover" data-content="some content"><div class="test">Hover over me!</div></a>

JavaScript

$('.infopop').popover({
html: true,
trigger: 'manual',
container: $(this).attr('id'),
placement: 'right',
content: function () {
    $return = '<div class="hover-hovercard"></div>';
}
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(this).siblings(".popover").on("mouseleave", function () {
    $(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
    if (!$(".popover:hover").length) {
        $(_this).popover("hide")
    }
}, 100);
});

Answer №1

To restrict the hover coverage to 100 x 100 pixels, consider including a display property with a value of "inline-block" within the test class.

.test {
    width:100px;
    height:100px;
    background:Red;
    overflow:hidden;
    display: inline-block;
  }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Arrange the div elements in a single horizontal line

Is there a way to align the company logo div next to the name, address, email, and phone number containers? I've attempted using display: inline and float: right, but the logo isn't moving up as desired. Here's the code snippet: http://jsfi ...

Modify NgbPopover location if window size is smaller than X

I am currently utilizing Angular 4 along with the Popover component from ng-bootstrap. Everything is functioning properly, but I am attempting to adjust its placement if the window size is less than 600px. Unfortunately, I have not come across an option fo ...

Tips for Utilizing Nav Dynamics Soap Webservice with php or jquery

My goal was to interact with Navision 2016 soap web services using either PHP or jQuery. I attempted to follow this approach PHP with Dynamics NAV webservices Here is the code I used for soap PHP: <?php if (extension_loaded('soap')) { // ...

Dealing with issues of toggling visibility with jQuery when using a dropdown menu

Inside a hidden drop down div, the focus is on "DC" right now. In the image below, we are looking at sales: HTML: <td class="edit"> <select class="touch" style="display: none;"> <option value="11">Rebuying</option><option value ...

React Native: The behavior of the 'top' property is consistent, while the 'bottom' property is not performing as anticipated

Within my React Native application, I have implemented the following code: <View style={{ width: 50, height: 50, borderWidth: 1, }} > <View style={{ width: 5, height: 5, backgroundColor: 'red', top: 10, ...

Is it necessary to capitalize the first letter only when it's not at the beginning of a sentence?

To separate a lengthy string, I followed the approach outlined in this post: .line { display: inline-block; } <p> <span class="line">This text should break</span> <span class="line">after the word "break"</span> </ ...

In the realm of JavaScript, removing a DOM element can sometimes feel like an

For my project, I am using JavaScript, DOM, and AJAX to create pages. I am trying to figure out how to check if an element already exists and, if it does, remove it. This is what I have tried: var elementL = document.getElementById('divLogin'); ...

Cannot get the arrow to rotate using Jquery's css() function

Having trouble using css() to rotate my arrow $(function() { $("#arrowAnim").css("transform:","rotate(300deg)"); }); Check out the fiddle here: https://jsfiddle.net/u4wx093a/10/ I've looked for similar issues but can't seem to solve it on my o ...

"Unusual bug in IE causing cell borders to disappear when colspan is used

Below is a sample table layout that I am working with: <table> <thead> <tr> <th>t1</th> <th>t2</th> <th>t3</th> <th>t4</th> ...

Elements are not detected after applying display:none

Within the onLoad event, I implemented a function to hide multiple div elements by setting their CSS property display to "none" and assigning them the class name "invisible": function hideContent() { laElements = document.getElementById("content").chil ...

Images and CSS are failing to load on Magento2

After downloading and installing Magento 2, I encountered a 404 error for scripts and css. A specific example of my image path is: I attempted to address this issue with the following solution: By opening up app/etc/di.xml and locating the virtualType ...

Error in Javascript caused by the use of Jquery's "hide on load" feature

Looking for help with creating a menu where the subitems disappear when the page loads. If you require the full HTML code, I can provide it, but essentially it consists of several DIVs, with the items under headers having a class of subitems. I was able ...

Prevent parent element from changing color when child element is clicked

Check out my HTML: .imageURL:active .image_submit_div { background-color: #ccc; } .image_submit_div:active { background-color: #e6e6e6; } <div class="image_div"> <label for="id_image" class="image_submit_div"> <h3>+ add ...

Can we avoid the error callback of an AJAX request from being triggered once we have aborted the request?

Initially, I encountered a challenge where I needed to find a way to halt an AJAX request automatically if the user decided to navigate away from the page during the request. After some research, I came across this helpful solution on Stack Overflow which ...

Struggling to set up a css3 keyframe slide effect and seeking help to properly configure it. Check out the Fiddle for more details

I am looking to create a responsive version of the animation in this fiddle (link provided below). I want the animation to be 100% wide and have a height of 500px. However, when I adjust the width to 100%, it causes issues at the end of the animation. Can ...

JavaScript and the Heron Formula

Is there a way to implement the Heron formula and semiperimeter with 3 sides in JavaScript? The function should return the area of the triangle based on input values of A, B, and C. Additionally, it needs to check if the sum of two sides is greater than ...

Is this JavaScript function acceptable?

My dilemma involves a carousel (specifically Owl Carousel) with controls that need to be vertically centered. Due to the structure, I have had to absolutely position the previous and next arrow indicators. Given the responsive nature of the page, their pos ...

How can I remove a quadratic curved arrow tool in Fabric JS canvas after it has been created?

I'm currently working on developing a tool for creating quadratic curved arrows. For reference, I utilized a demo from the following link to build the tool: I have successfully created the tool as per my requirements. However, I am encountering some ...

What could be causing my table to malfunction in IE8?

Is it just me, or do my CSS tables not work on IE8? <div class="main-table"> <div class="row"> <a class="secondary-table" href="#"> <div class="secondary-row"> <div class="secondary-cell"> ...

What is the best way to submit data from multiple forms on a single `cshtml` page with identical field names to a single controller method?

I have multiple forms on the same page with identical field names. I need to post data from a specific form to the controller when the submit button for that form is clicked. How can I accomplish this? Below is the jQuery method I have created: var valS ...