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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:52:10+00:00 2026-05-23T07:52:10+00:00

ok ,i dynamically increase the width of an empty div with css property of

  • 0

ok ,i dynamically increase the width of an empty div with css property of opacity 0.5,
when the mouse is dragged to the right side.i also want to increase the width of the same div element when it is dragged to the left side(i.e) the width reaches below zero,i can absolute the value of width but i want the ui to be increasing in the same direction as well? Any ideas would be appreciated ,thanks in advance!

 #thing {
 position: absolute;
 border: 2px dashed #000;
 background-color: #fff;
 opacity: .2;
 z-index: 999999;
}    

–

var t = document.getElementById("thing");
//this is performed on mouse drag
t.style.width  = Math.abs(x - oldX) + "px"
t.style.height = Math.abs(y - oldY) + "px"

//also the html part
<div id="thing"></div>

when x value is less than oldx value that is the mouse drag is performed to the left side ,i want the ui change(change in width and height) to be reflected to the left side.

  • 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-05-23T07:52:10+00:00Added an answer on May 23, 2026 at 7:52 am

    Here’s a working, commented solution you can learn from, for the x-axis only, tested in Firefox but probably cross-browser.

    http://jsfiddle.net/steve/QV6PV/

    To answer your question directly, you need to move the left side and increase width simultaneously (indicated in the code).

    You can put in some conditional statements to deal with problems of min/max width. Also an event handler to fire this on a click will probably be required.

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

Sidebar

Related Questions

I have some dynamically created inputs which are not server-side controls. I want to
I am modifying some HTML pages and want to increase the font size dynamically
I am trying to build a textarea whose width will dynamically increase while inserting
Dynamically I want to edit/update hosts(etc/hosts) file to add domain. To edit hosts(etc/hosts) file
Let's say i have a div called .number containing a number. i want to
I want a loop to dynamically create a table up to 2 columns wide,
I have float left and float right <div> nested within a light blue box
I have an html where i want to add another div within the description
I have an element as follows <div id=loadNavigation style=width:20%></div> <div id=loadContent style=width:80%></div> Essentially navigation
I have a program to dynamically increase the capacity of a hashtable when the

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.