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

  • Home
  • SEARCH
  • 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 3934908
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:46:11+00:00 2026-05-19T23:46:11+00:00

I have found (not written) a piece of code for a resizable div that

  • 0

I have found (not written) a piece of code for a resizable div that works beautifully in firefox and IE, but in Chrome it’s very difficult to expand–it often just ignores you if you try to stretch it. I’m not even sure why this is–it’s difficult to troubleshoot.

Any hint as to why chrome is often refusing to expand this div would be nice. Try for yourself.

#mydiv{
    position:relative;
    top:0px;
    left:0px;
    width:250px;
    border: 1px solid #808080;
    overflow: auto;
}

#statusbar{
    cursor: s-resize;
    position:relative;
    display:block;
    background-color: #c0c0c0;
    font-size: 0px;
    margin:0;
    height:5px;
    border: 1px solid #808080;
    padding:0;
    width: 250px;
}

scripts:

var curHeight=0;
var curMousePos=0;
var mouseStatus='up';
var curEvent;

//this function gets the original div height
function setPos(e){
    curEvent=(typeof event=='undefined'?e:event);
    mouseStatus='down';
    //gets position of click
    curMousePos=curEvent.clientY;
    curHeight=parseInt(document.getElementById('mydiv').style.height.split('p')[0]);
}

//this changes the height of the div while the mouse button is depressed
function getPos(e){
    if(mouseStatus=='down'){
        curEvent=(typeof event=='undefined'?e:event);
        //how many px to update the div? difference of previous and current positions
        var pxMove=parseInt(curEvent.clientY-curMousePos);
        var newHeight=parseInt(curHeight+pxMove);
        //conditional to set minimum height to 5
        newHeight=(newHeight<5?5:newHeight);
        //set the new height of the div

        document.getElementById('mydiv').style.height=newHeight+'px';
    }
}

finally the HTML:

    <div>
    <div id="mydiv" style="height: 250px; min-height:150px; ">
        <div></div>
    </div>
    <div onmousedown="setPos(event)" onmouseup="mouseStatus='up'" id="statusbar"></div>
</div>

EDIT: seems chrome supports the CSS3 property RESIZE. This is awesome and totally better than the JS approach I used. Still, I wish the above code worked on chrome as it does on FF/IE so I wouldn’t have to check for the browser type.

  • 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-19T23:46:12+00:00Added an answer on May 19, 2026 at 11:46 pm

    enter image description here

    <!doctype html>
    
    <html>
        <head>
            <script>
                window.onload = function () {
                    var div = document.getElementById ("statusBar");
    
                    var press = false;
    
                    div.onmousedown = function () {
                        press = true;
    
                        return false;
                    }
    
                    this.onmousemove = function (event) {
                        event = event ? event : window.event;
    
                        if (press === true) {
                            div.style.height = event.clientY + "px";
                        }
                    }
    
                    this.onmouseup = function () {
                        press = false;
                    }
                }
            </script>
    
            <style>
                #statusBar {
                    background-color: #c0c0c0;
                    border: 1px solid #808080;
                    cursor: s-resize;
                    margin: 0;
                    min-height: 5px;
                    padding: 0;
                    width: 250px;
                }
            </style>
    
            <title></title>
        </head>
    
        <body>
            <div id = "statusBar"></div>
        </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a hum-dinger of a problem that I have not found an answer
I've tried various editors, both desktop applications and web-based RTEs, but have not found
I have found some in the Cappuccino website (vim, textmate and SubEthaEdit), but not
I have just installed Eclipse 3.4 and found out that there is not a
I have found that my HTML is, to be honest, very clunky. Small, simple
I have scanned 'the Google' and have not found the definitive answer on whether
In my routing I would like to have something like not found route handler.
After a review of the iPhone SDK documentation, I have not yet found a
I am not used to manipulate bytes in my code and I have this
Ok so i have this piece of code: def findNReplaceRegExp(file_name, regexp, replaceString, verbose=True, confirmationNeeded=True):

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.