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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:07:27+00:00 2026-05-31T20:07:27+00:00

Basically i am trying to scale an img with an id=room according to a

  • 0

Basically i am trying to scale an img with an id=”room” according to a parameter wich will be +1 or -1 (and its a constant that i want to scale +-10%)

this is how i am trying

function scalar(scaleP100){ /* scaleP100 is +1 or -1 (no  other posible value)*/
                    var addX = $('#room').width()*10*scaleP100/100;
                    var addY = $('#room').height()*10*scaleP100/100;
                    var newW = $('#room').width()+ addX;
                    var newH = $('#room').height()  + addY;
                    $('img#room').css({'width':newW,'height':newH});
                    console.log(newW +','+ newH+':'+$('img#room').length);
                    return false;
}

This is inside a mouswheel detection,

So it has two stages: +10% from original size, and -10% from original size. I just don’t know why it doesn’t scale acording the current size (instead of the original size)

what am i doing wrong?

If you want to see what i probably didn’t explain well, please check http://toniweb.us/m/3d/adam.html (but mousewheel outside the image only)

Thanks

  • 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-31T20:07:28+00:00Added an answer on May 31, 2026 at 8:07 pm

    you have two elements with same id:
    <div id=”room”> and <img id=”room”>
    This should work, but I suggest you to make your html cleaner..

    function scalar(scaleP100){ /* scaleP100 is +1 or -1 (no  other posible value)*/
        var addX = $('img#room').width()*10*scaleP100/100;
        var addY = $('img#room').height()*10*scaleP100/100;
        var newW = $('img#room').width()+ addX;
        var newH = $('img#room').height()  + addY;
        $('img#room').css({'width':newW,'height':newH});
        console.log(newW +','+ newH+':'+$('img#room').length);
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically I am trying to make a model loader, that will take in
I am basically trying to trigger a function if the footer is inside the
I'm basically trying to convert a Unix timestamp (the time() function) to a relative
I'm trying to build some image algebra code that can work with images (basically
I am basically trying to create a display object transformation manager which will allow
Scala Newbie alert: basically I'm trying to do something like this: where I pattern
I'm trying to create a spectral image with a constant grey-scale value for every
I'm trying to plot a logarithmic scale, but I keep on getting this error:
This is a question that came from an earlier problem I had . Basically,
Thanks for looking into this. Basically, what I am trying to do is to

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.