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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:56:01+00:00 2026-05-24T22:56:01+00:00

This is my first jQuery plugin and I think it is a pretty awesome

  • 0

This is my first jQuery plugin and I think it is a pretty awesome one =). The plugin takes an element and ensures that it is always on screen. If the element is too large for the screen then as much of it is shown as possible. You can test a working example by simply scrolling up and down. Notice how the content does its best to stay with you.

My problem is that I don’t know how to handle a change in the window layout. Say a user resizes the window, how do I make my plugin handle it? I basically need to recalculate everything from scratch. I could bind to $(window).resize(), but where do I do that? In my main js block? In my plugin? What do I do inside of it?

I have a feeling that this is relatively straightforward, but my brain is freezing.

  • 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-24T22:56:02+00:00Added an answer on May 24, 2026 at 10:56 pm

    I would have a different code structure, something like this:

    (function($){
        var _constants = { 
            default: {}
        }
        var _variables = { 
            options: {},
            jElement: undefined
        }
    
        var _private: {
            init: function(jElement, options){
                _variables.jElement = jElement;
                _variables.options = $.extend({}, _constants.default, options);
                _private.setSize();
                $(window).resize(_private.setSize);
                return jElement;
            },
            setSize: function(){
    
            }
            //... other private methods go here ...
        }
    
        $.fn.dynamicSidebar = function(options) {
           return _private.init($(this), options);
        }
    )(jQuery);
    

    Edited for relevance

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

Sidebar

Related Questions

This may be a very mundane question, but this is the first jQuery plugin
This is my first attempt at a plugin but I think I'm missing the
I've written my first JQuery plugin and one of it's dependancies is an external
This is my first time attempting to call an ASP.NET page method from jQuery.
With jquery, I'm dynamically adding rows. To do this, I'm copying the first of
Saw this piece of code in a Ruby on Rails book. This first one
this my first shot at this awesome new (to me) programmers site, I hope
First, I know that there are jQuery plugins for search suggest. The reason I'm
I have written a plugin that looks like this so far: (function($) { var
This is my first attempt at adding ajax to a WordPress plugin. I have

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.