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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:16:40+00:00 2026-05-23T09:16:40+00:00

I’ve got a native JavaScript function and I’d like to rewrite it in jQuery.

  • 0

I’ve got a native JavaScript function and I’d like to rewrite it in jQuery. Can you help me? Way beyond my understanding…

EDIT: Quickly addressing the “please refactor my code for me” comments- I’m not asking you to rewrite the work, I’d simply like some guidance on how to rewrite this. As you all have experienced at some point, documentation, tutorials, and books that are helpful can be difficult to find. Any advice is welcome, but..

if(you dont have anything nice to say){
    dont
}



 var RESIZER = function(){ 

    this.prevWidth = resizee.offsetWidth;
    this.prevHeight = resizee.offsetHeight;

    this.resizee = resizeeContainer.getElementsByTagName('video')[0];
    this.resizeeContainer = resizee.parentNode;
    this.resizeeStyle = this.resizee.style;

    var ratio = this.resizee.offsetHeight/this.resizee.offsetWidth;

    var that = this;

    this.Init = function(){
        if( that.resizeeContainer.className.lastIndexOf("resizerd")>=0 )
        {
            var resizeeContOffsetWidth = that.resizeeContainer.offsetWidth;
            var resizeeOffsetWidth = that.resizee.offsetWidth;
            var resizeeContOffsetHeight = that.resizeeContainer.offsetHeight;
            var resizeeOffsetHeight = that.resizee.offsetHeight;

            if(that.prevWidth!= resizeeContOffsetWidth)
            {
                that.prevWidth = resizeeContOffsetWidth;
                var desired = resizeeContainer.offsetHeight/resizeeContainer.offsetWidth;
                if(desired>ratio){
                    that.resizeeStyle.width=resizeeContOffsetWidth*desired+resizeeContOffsetWidth*desired+"px";
                    that.resizeeStyle.left = -1*(resizeeOffsetWidth-resizeeContOffsetWidth)/2+'px';
                }
                else{ 
                 that.resizeeStyle.cssText="width:100%;height:auto;position:fixed;";
                }
            }

            if(that.prevHeight!=resizeeContOffsetHeight)
            { 
                that.prevHeight = resizeeContOffsetHeight;
                var desired = resizeeContOffsetHeight/resizeeContOffsetWidth;  
                if(desired>ratio){  console.log(ratio);
                    //that.resizeeStyle.top = '0px';
                    that.resizeeStyle.left = -1*(resizeeOffsetWidth-resizeeContOffsetWidth)/2+'px';
                    that.resizeeStyle.width = resizeeContOffsetHeight*desired+resizeeContOffsetHeight/desired+'px';
                }
                else
                {
                    that.resizeeStyle.top = -1*(resizeeOffsetHeight-resizeeContOffsetHeight)/2+'px';

                }
            }

        }
    };
};

var myResizerObject = new RESIZER();
window.onresize = myResizerObject.Init;
  • 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-23T09:16:41+00:00Added an answer on May 23, 2026 at 9:16 am

    Developing jQuery plugins, while not real difficult, is not trivial either. The only way to do it is to start with a tutorial and learn the ins and outs. Then you can take a piece of code and turn that code into a functioning plugin. But you have to learn some things first.

    If you haven’t gone through the jQuery beginner plugin tutorial, I would: http://docs.jquery.com/Plugins/Authoring Try developing a simple plugin first, like an input field validation plugin or something.

    I’m not sure what you mean by the native script and browsers interpreting differently; some JS is browser-dependent. jQuery-native functions should be browser-agnostic.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
i got an object with contents of html markup in it, for example: string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a JSP page retrieving data and when single or double quotes are
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.