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 7892273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:49:44+00:00 2026-06-03T06:49:44+00:00

How to add overlay to my codes. <div class=demo> <div style=width: 300px; height: 91px;

  • 0

How to add overlay to my codes.

<div class="demo">
    <div style="width: 300px; height: 91px; position: absolute; top: 148px; left: 12px;" class="resizable ui-draggable ui-resizable ui-draggable-disabled ui-state-disabled" id="resizable" aria-disabled="true">

    <div class="ui-resizable-handle ui-resizable-n"></div><div class="ui-resizable-handle ui-resizable-e"></div><div class="ui-resizable-handle ui-resizable-s"></div><div class="ui-resizable-handle ui-resizable-w"></div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 1001;"></div></div>
    <div class="zoomslide ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all" style="display: block;"><a href="#" class="ui-slider-handle ui-state-default ui-corner-all" style="left: 0%;"></a></div>
<div id="the_image" style="top: 12px; left: 12px; position: absolute;" class="ui-draggable"><div class="imgdiv" style="background: none repeat scroll 0% 0% red; height: 350px; width: 300px; overflow: visible;"><img width="334" height="350" src="images/lion-man.jpg" class="img1 image" id="first" style="position: relative; top: 0px; left: -17px;"></div></div></div>

What i need is when the crop button is click, and the full image is displayed, it should overlay on the part of the image outside the white-bordered-box.

I think it should create div’s and set opacity outside the white-bordered box, but I’ having trouble implementing it.

It should be something like:

function overlay(){
//codes here
}

Any help please.

http://deadwoodfilms.com/jquery/picture3/picture.html

  • 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-03T06:49:45+00:00Added an answer on June 3, 2026 at 6:49 am

    The problem:

    Unfortunately CSS backgrounds are additive in nature, you can cover something to add color but you can not negate color.

    Solution one:

    What you would need to do is actually have two versions of the image. One as a base, covered by the overlay. The second as the selection (on top of the overlay), with the edges cut off. Position it all correctly and the user will never know that they are seeing two images.

    You will need an <img> (or a <div> with background) plus two <div> elements one of the same dimensions as the image, the other with the dimensions of the selection. The three should all use position: absolute; and be contained in an element with position: relative;.

    The first <div> will act as the overlay, just give it a nice background color, and opacity if you want.

    The second <div> is the magic. You will set the background of this <div> to your image.

    Now using JS you can adjust the `background-position: Xpx Ypx;’ property such that the portion of the image that is shown matches with the position of the selection.

    Suppose the image is 500x500px, and the selection is at (100,100). Setting `background-position: 100px 100px;’ should make it match up, though some adjustments may need to be made to account for any borders you may be using.

    Obviously your JavaScript would also need to account for any modification of image size, as that would throw off the selection alignment.

    Solution two:

    You can use 4 <div> elements, all overlays, such that there is one <div> across the top of the image, another across the bottom, and one to each side of the selection. Those <div>‘s would then be dynamically re sized with JavaScript to to account for the size of the selection. This would have the effect of covering all area outside of your selection.

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

Sidebar

Related Questions

I would like to add an overlay image on a Google Map. The image
I'm trying to add an overlay to a MapView from a background thread to
Is it possible to add an image overlay to a google map that scales
I want to add a custom overlay (a png) in the middle of the
I add to application public class ShakeActivity extends Activity implements SensorListener But I receive
I have this button, when I click it, I want to add a class
I found a lot of examples how to add/remove Overlays to your Openlayers Map
I'm trying to add different icon overlays over the icons of various files (note:
Add service reference to Amazon service fails, saying Could not load file or assembly
Quick add on requirement in our project. A field in our DB to hold

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.