Interactive Video Effect

Seeking to create a unique video hover effect on an image where, when the mouse hovers over it, a video pops up similar to examples found on this website.

I have been grappling with finding a solution for this issue over the past few months.

Does anyone possess the knowledge and skills to achieve this?

This relates to an image hover effect that I have successfully implemented. Instead of the image popping up, is there a way to make a video pop up in the same manner?

<html>
<head>
<title>Test</title>
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>


<script type="text/javascript">


$(document).ready(function () {


    $('div.thumbnail-item').mouseenter(function(e) {

        x = e.pageX - $(this).offset().left;
        y = e.pageY - $(this).offset().top;

        $(this).css('z-index','15')
        .children("div.tooltip")
        .css({'top': y + 10,'left': x + 20,'display':'block'});

    }).mousemove(function(e) {

        x = e.pageX - $(this).offset().left;
        y = e.pageY - $(this).offset().top;

    $(this).children("div.tooltip").css({'top': y + 10,'left': x + 20});

    }).mouseleave(function() {

        $(this).css('z-index','1')
        .children("div.tooltip")
        .animate({"opacity": "hide"}, "fast");
    });

});


</script>
<style>

    .thumbnail-item { 

position: relative; 
float: left;  
margin: 0px 5px; 
     }

      .thumbnail-item a { 
display: block; 
      }

     .thumbnail-item img.thumbnail {
border:3px solid #ccc;  
     }

       .tooltip { 

display: none; 

position: absolute; 

padding: 8px 0 0 8px; 
       }

.tooltip span.overlay { 

    background: url(images/overlay.png) no-repeat; 

    position: absolute; 
    top: 0px; 
    left: 0px; 
    display: block; 
    width: 350px; 
    height: 200px;
}
</style>
   </head>
    <body>



<div class="thumbnail-item">
    <a href="#"><img src="images/Capture1.jpg" class="thumbnail"/></a>
    <div class="tooltip">
        <img src="images/2 Davis Road.jpg" alt="" width="330" height="185" />
        <span class="overlay"></span>
    </div> 
</div> 

<div class="thumbnail-item">
    <a href="#"><img src="images/Capture2.jpg" class="thumbnail"/></a>
    <div class="tooltip">
        <img src="images/Camberwell Town Hall, Roof Restoration.jpg" alt="" width="330" height="185" />
        <span class="overlay"></span>
    </div> 
</div> 

<div class="thumbnail-item">
    <a href="#"><img src="images/Capture3.jpg" class="thumbnail"/></a>
    <div class="tooltip">
        <img src="images/Children.jpg" alt="" width="330" height="185" />
        <span class="overlay"></span>
    </div> 
</div>      

<div class="clear"></div>

Answer №1

To enhance user experience on your website, you can incorporate jQuery with event listeners such as `mouseenter` and `mouseleave` to dynamically insert a video element within a tooltip. Utilizing tools like Bootstrap and jQuery UI can help create visually appealing tooltips for your web pages.

For example, here is a snippet of code using jQuery:

$(".video").on("mouseenter", function(){
    var video = "<video></video>"; // Make sure to include the src attribute, etc...

    // Implement code to display the tooltip

    $(".tooltip").append(video); // Assuming the tooltip has a class of .tooltip

    $(this).on("mouseleave", function(){
        // Add code here to hide the tooltip when the cursor leaves
    }
})

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

JQuery syntax for adding a comma before the first element in an array

When I insert data into an array, the output in my console includes a comma before the first element (9). How can I remove this comma from the first element using the provided code snippet? ,9,My firstname,My lastname,<a href="/cdn-cgi/l/email-protecti ...

Layering digital sheets of paper and rearranging them with the help of CSS

I want to create a visual representation of a stack of paper sheets as a metaphor. The idea is to neatly stack the sheets on top of each other, with only the header of each sheet visible and the rest of the content covered. !-------------- | Sheet 1 +--- ...

Picture inside text area covering drop-down list

After making some adjustments to Bootstrap using a custom -theme.css file, I successfully altered the appearance of the dropdown menu. By removing the borders from the navbar and wrapping a header around it set to be fixed on top, everything seemed to be w ...

What could be the reason for my ng-init not functioning properly?

<body ng-init="user=${userID};month=${month};curPageNum=${currentPage}"> Using JSP, I set initial values in the body tag. However, in the controller, I have the following code: console.debug($scope.user + " "+$scope.month} The issue is that only ...

Element not found: {"method":"name","selector":"markUp"}

Snippet : System.setProperty("webdriver.chrome.driver", "C:\\Users\\pkshirs3\\SeleniumMaterial\\chromedriver.exe"); WebDriver webDriver = new ChromeDriver(); String urlToBeUsed = "internalURL"; webDri ...

Determining the background image size of a div when the window is resized

I'm facing a problem that I can't seem to solve. I have a div with a background image. <div class="a"></div> I want to make a specific point of this background image clickable. I know I can achieve this by adding a div with a z-inde ...

Align an image in the center of a div without using absolute positioning

I'm currently facing an issue where I need to align an image at the center of a div without using absolute positioning. This is necessary because the image spills over into any adjacent divs on the page. Specifically, I have a previous div containing ...

The width of an HTML input and button elements do not match

Currently, I am facing an unusual issue where my input and button tags seem to have the same width assigned to them (width: 341.5px; calculated from $(window).width() / 4) in the code, but visually they appear to be of different widths. Here is a visual re ...

Diverse Ajax-Driven Get Request in Django Application

Having recently started using Ajax and being familiar with Django for a while, I'm looking to dynamically submit a form in a way that appends a new parameter to the URL without refreshing the page and updates the displayed data. For instance, changing ...

Showing a text value from a Github Gist on a Hugo website

I seem to be struggling with a seemingly simple task and I can't figure out what I'm missing. Any assistance would be greatly appreciated. I am working on generating a static site using Hugo. On one of my pages, I want to implement a progress ba ...

Controlling the page scroll when adding data using jQuery

I am encountering an issue with a webpage that displays around 20 pictures in separate divs stacked vertically. Below these 20 pictures, there is a "show more" button that, when clicked, loads another set of 20 pictures and appends them to the existing dat ...

Tips on saving Firebase Storage image url in Firebase database?

How do I store the URL of an image uploaded to Firebase Storage in Firebase Database? When executing the code below, I encounter the following error: Uncaught (in promise) FirebaseError: Function DocumentReference.set() called with invalid data. Unsuppor ...

Is it possible to convert (HTML and CSS3 generated content for paged media) into a PDF format?

Would it be possible to convert a HTML document styled with CSS3 Generated Content for Paged Media into a PDF format? If such an application does not exist, what alternatives can I consider as the foundation for developing a converter? Thank you ...

Is there a way to transmit a div using Node.js?

Scenario: I am developing a web application that allows users to draw on a canvas, save the drawing as an image, and share it with others using Node.js. Current Progress: Drawing functionality (real-time updates on both clients). Saving the canvas as a ...

Tips for assigning a string value to an <li> element with Jquery

I have a database table structured as follows: ID name aa1 Tom bb2 Jack cc3 Mike To display this data in an HTML format, I am using Ajax to pass the values. $.ajax({ ... success: function (data) { $.each(data, f ...

Implementing JSON data presentation in Laravel: a step-by-step guide

I have implemented an AJAX call to retrieve data from the database in JSON format, but I am facing difficulties displaying it on the view. Below is my AJAX code: $(document).ready(function() { $("#inProgress").click(function(e) { e.prevent ...

Trouble locating SVG element in Google Calendar when using Python

I'm currently facing an issue while attempting to delete an event from my Google Calendar. An error keeps popping up indicating that the webdriver is unable to locate the element. Here's an image of the problematic element. Exception has occurred ...

Tips for automatically loading a new page or URL when a user scrolls to the bottom

I am working on implementing infinite scroll functionality, where a new page loads automatically when the user reaches the bottom of the page or a particular div. Currently, I have this code that loads a new page onclick. $("#about").click(function(){ ...

Is there anyone who can assist in refining the padding and margin issues within this Galleria.js implementation?

I am struggling to understand why the padding and margins around the images in this slideshow theme on PregoApp are uneven. Despite my attempts to adjust the CSS, the issue persists. You can view the site here. Another website using the same implementati ...

Closing the nested accordion will collapse all sections within the accordion

I'm currently facing an issue with my nested accordions. I've been attempting to nest them in a way that doesn't require writing additional jQuery code for each new one added. As an example, I've created a jsfiddle... https://jsfiddle. ...