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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:53:55+00:00 2026-05-26T09:53:55+00:00

I’m using CSS’s resize property to resize a div element in FF, Safari, and

  • 0

I’m using CSS’s resize property to resize a div element in FF, Safari, and Chrome, but since this property doesn’t work in IE and Opera, I am forced to find a backup in case one of these two browsers is being used, so I’m using a combination of Jquery and javascript, to ask a function I found online, here: Browser resize support code
. Unfortunately, this is the code I fear isn’t working in my test to see if it would work.

Here’s my test code: My code

var unsupported = (function()
{
    var div = document.createElement('div'),
    vendors = 'Khtml Ms O Moz Webkit'.split(' '),
    len = vendors.length;
    return function(prop)
    {
        if( prop in div.style ) return true;
        prop = prop.replace(/^[a-z]/, function(val)
        {
            return val.toUpperCase();
        });
        while(len--)
        {
            if ( vendors[len] + prop in div.style )
            {
                return false;
            }
        }
        return true;
    };
})();
if( unsupported('resize') )
{
    $("#elementtoresize").append('<img class="resizer" src="resizer.png"/>');
    var r = true;
}
$(".resizer").mousedown(function(e){
    if(r)
    {
        var Xoffset = this.parentNode.offsetLeft + this.parentNode.offsetWidth - e.clientX;
        var Yoffset = this.parentNode.offsetTop + this.parentNode.offsetHeight - e.clientY;
        r = false;
    }
    $(".resizer").mousemove(function(e){
        this.parentNode.offsetWidth = e.clientX + Xoffset - this.parentNode.offsetLeft;
        this.parentNode.offsetHeight = e.clientY + Yoffset - this.parentNode.offsetTop;
    }
    $(".resizer").mouseup(function(){
        r = true;
    }
}

It additionally requires an image in the same folder as the script, preferably 10×10 or smaller to be used as the icon for resizing the div element, but not only does the resizing not work, the image doesn’t even display, which is what leads me to believe that the variable for checking the CSS is what’s causing the problem, because without it the image is never appended inside the div element. But since I didn’t write the code and there were no other codes I could find for checking to see if the specific CSS property is supported, I have no way of really finding the error. If you’re going to try testing the code, you’ll also need this bit of code inside the style tag.

.resize
{
z-index:2;
position:absolute;
right:5;
bottom:5;
}

Any help fixing the code would be appreciated!

  • 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-26T09:53:55+00:00Added an answer on May 26, 2026 at 9:53 am

    That code is wrong in many ways, including syntax and approach.

    First of all, you should use a library like Modernizr for testing feature support. Anyway, if you’re going with this code, try not changing just parts of it. The function unsupported fails because you didn’t change all of it’s return points. In the future, wrap the original function if you really need to use new naming. Like unsupported = function (x) { return !supported(x); };

    Moreover, the original function you used was incomplete. While it didn’t affect your particular case, I took the liberty to improve it. Find it here: http://jsfiddle.net/mihaibirsan/NCs5J/

    Second, the resizing code was really messy. When you pass functions as parameters, don’t forget to close the parenthesis of the function call! Also, using global variables is absolutely bad—avoid at all costs! Besides, since you’re using jQuery, why not wrap the functionality in a nice little jQuery function? You can find the code here: http://jsfiddle.net/mihaibirsan/Rty3R/8/

    So your code should come down to the bits and pieces pasted before (without the testing code), plus the following line:

    if (!supported('resize')) $("#elementtoresize").resizable();
    

    I hope this helps! If it pleases you, please accept the answer! I do this for the points!

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
Seemingly simple, but I cannot find anything relevant on the web. What is 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.