Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8487275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:11:28+00:00 2026-06-10T21:11:28+00:00

I wrote a hover zoom plugin and I’m trying to figure out how to

  • 0

I wrote a hover zoom plugin and I’m trying to figure out how to dark out everything outside of the hover zoom box, and make the zoom box itself transparent, but am having a tough time trying to figure out what I need to do for it. Do I use opacity? Do I use a background image?

Right now it’s just showing a white .5 opacity on top of a darker black opacity bg, but I’m kinda scratching my head trying to figure this out. Any suggestions would be super helpful.

What I’m trying to do:

enter image description here

Demo: jsfiddle

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:11:30+00:00Added an answer on June 10, 2026 at 9:11 pm

    Here’s an example of a solution, but it requires you to make a couple of changes.

    If you set the zoom square to have a background image the same as the underlying image and adjust its background-position by css to be the negative of its position relative to the original image… am I explaining this correctly?

    http://jsfiddle.net/moopet/Be9AA/

    The important part is

    var left = Math.min(Math.max(relX - 100, 0), $origImg.width() - $zoomBox.width()),
        top = Math.min(Math.max(relY  - 100, 0), $origImg.height() - $zoomBox.height());
    
    $zoomBox.css({
        left: left,
        top: top
    });
    
    $zoomBox.css({ backgroundPosition: (-left) + "px " + (-top) + "px" });
    

    And I’ve set the background of the zoom element in the CSS for the fiddle, but if you needed to do this for multiple images you could do it in JS by just copying the src attribute.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make my hover-action with slowly bg-image changing. .menu_part { border-left: 1px
When I wrote the following snippet for experimenting purposes, it raised the hover-error (see
I wrote a jquery code that is going to expand certain elements on hover.
I wrote this quick tooltip function for my links: $(function() { $('a').hover(function(e) { var
trying to fix a CSS bug for some code that someone else wrote. I'm
I am trying to write some code where a description box pops over an
I wrote this page to be an image gallery. When you hover over a
I wrote a slideshow plugin, but for some reason maybe because I've been working
I'm using jquery.rating.js plugin and I wrote a litle function that shows the value
i wrote hover animation in jQuery and it works great but does not work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.