Zoom in on the image when hovering and include highlighted text

Seeking a tutorial on enlarging an image on mouse hover, then shading the enlarged image dark for text overlay.

This example lacks the ability to enlarge the image: http://jsfiddle.net/balupton/FZG3v/

CSS:

.ih { position:relative; }
.ih, .ih-image, .ih-info { display:block;width:330px;height:220px; }
.ih-image, .ih-info { z-index:500;position:absolute;top:0;left:0;right:0;bottom:0; }
.ih-info { z-index:501;background:black;color:white; }

HTML:

<img class="ih-image" src="http://designsnack.com/screenshots/image.php width=330&amp;height=220&amp;cropratio=330:220&amp;image=/screenshots/8264948088.jpg"/>
     <div class="ih-info">
         Your overlay content
     </div>
</div>

JS:

$(function(){
$('.ih').hover(
    // Over
    function(){
        var $ih = $(this);
        $ih.find('.ih-info').stop(true,true).animate({opacity:0.8}, 400);
    },
    // Out
    function(){
        var $ih = $(this);
        $ih.find('.ih-info').stop(true,true).animate({opacity:0}, 400);
    }
).find('.ih-info').css('opacity',0);
});

If I am unclear or missing any information, please forgive me as this is my first question.

Appreciate any assistance!

EDIT: Special thanks to ghost! My ultimate goal is to enlarge the image from the center for a 4X2 image configuration.

Answer №1

There are numerous techniques in jQuery to achieve this, but one effective method is by utilizing the animate() function to gradually adjust image dimensions. Check out this example: http://jsfiddle.net/FZG3v/44/

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

Is "align-content-end" the correct way to align the div to the bottom?

I recently started learning BootStrap and delving into web development. Despite watching numerous video tutorials and reading the documentation, I am still struggling with layout issues – something isn't quite clicking for me. My goal is to create ...

Error: discord-webhooks causing SyntaxError due to an unexpected identifier in JavaScript code

I am currently working on a javascript project to set up a webhook for Discord. The URL has been removed for privacy reasons. const DiscordWebhook = require("discord-webhooks"); let myWebhook = new DiscordWebhook("removedtopostonstackexchange") myWebhook. ...

Instructions on how to extract and display the key-value pairs from a nested JSON array in Angular 2, then populate them in a select box

My goal is to extract data from a Json data model and populate a select box with the data as drop-down items. However, I am encountering difficulties in achieving this as the entire Json array is being printed instead of just the 3 major headings that I wa ...

unable to properly assess the functionality of the timeout feature within the useEffect hook

I've been working on a lazyload image loader component that only loads images if they have been visible for more than 500ms. Although the functionality is working as expected, I'm facing challenges when it comes to writing a test to validate its ...

Express.js code is experiencing difficulties with autocomplete functionalities

jQuery autocomplete code example [Express JS code for retrieving data][2\ Example of fetching data in Express JS ...

Unable to modify zoom settings in iOS using javascript

My website is 1000x820 in size, but please don't ask me about responsive web design. Here's the viewport setup: <meta name="viewport" content="target-densitydpi=device-dpi, width=1000px, user-scalable=no"> When accessed on an iPhone SE w ...

What is the best way to serve a .ttf file in node.js with the http and fs libraries?

I am running a basic node server and I have a CSS file that is trying to load a font from the server: @font-face{ font-family: 'NiagaraSolid-Reg'; src: url('http://localhost:1111/NIAGSOL.TTF'); } This is my attempt at servin ...

I am having an issue in React.js where my state is not updating until the second click instead of the first one

Whenever I click items on my dropdown menu, the state only updates after clicking twice. I have provided a video and some code snippets for reference. How can I resolve this issue? https://i.sstatic.net/LkXUx.gif Parent Class Component (APP): class App e ...

Limiting the display of every item in Angular ngFor

I'm currently working with Angular and I have the following code in my component.html: <div class="card" *ngFor="let item of galleries;" (mouseenter)=" setBackground(item?.image?.fullpath)" (mouseover)="showCount ...

Displaying a message when jQuery autocomplete returns no results, and the submission cannot be completed

My expertise in jQuery is lacking, but I am trying to implement two functions simultaneously with the jQuery autocomplete feature. Firstly, I want to display a "no results found" message when there are no matches for the search input, and in this scenario, ...

An apparently vacant span or div element may not be as empty as it

Why is it that when I successfully check the username, the span with id user_error becomes empty, but it doesn't work the same way for checking the email where the span email_error is still not empty? <form name="field" method="post" id="form"> ...

Issues with iPad's ajax functionality

After a lengthy process, I was tasked with developing a chat feature that functions flawlessly on various devices but seems to be glitchy specifically on the iPad and possibly the iPhone. The client heavily relies on their iPads for communication, so solvi ...

Navigate through each file or image within a directory using Angular

I am facing a challenge with my app where each product has a gallery containing a random number of images, each with a completely unique name. These images are located in /src/assets/images/products/:id/. Currently, I am struggling to loop through and add ...

HTML tag for text content identification

Can anyone help me identify the most effective HTML tag element to format literal text with various styles? I previously used the SPAN tag to set the width style, but it didn't produce the desired result. I need to create tabulation for multiple fie ...

THREE.FileLoader cannot be used as a constructor(…)

Currently, I am attempting to import a model into my scene. These are the files that I have included at the beginning of my project: <script src="js/build/three.min.js"></script> <script src="js/loaders/OBJLoader.js"></s ...

How do you obtain the string name of an unknown object type?

In my backend controllers, I have a common provider that I use extensively. It's structured like this: @Injectable() export class CommonMasterdataProvider<T> { private readonly route:string = '/api/'; constructor(private http ...

Mongo slices left blank

I'm currently working on an image upload feature using MongoDB, nodeJS, express, multer, jimp, and gridFS. Initially, I upload the image with multer, then resize it with jimp before uploading the jimp buffer to MongoDB. However, when I try to delete t ...

Developing a dynamic user interface using an Angular framework and populating it with

I am currently learning Angular (version 1) and facing an issue with my layout. I need to dynamically change the navigation based on the type of user that is logged in. To achieve this, I make an API request when the page loads to fetch the user object dat ...

Is there a different option instead of relying on promises for asynchronous requests?

Let's consider a scenario where we have a basic front end application (perhaps using Angular) and a back end app. When the front end app performs a get request, in most cases, the Angular repository will initiate an $http.get request which will return ...

What is the best way to minimize spacing within a table cell in an HTML table?

Looking for a solution to reduce spacing and padding in my html table cell? #table1 td { font-size: 200px; } <table id="table1" border="1"> <tr><td>1</td></tr> </table> https://i.sstatic.net/kVTIu.png Check it out ...