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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:12:09+00:00 2026-05-16T21:12:09+00:00

I have a function which will resize the image background when the page is

  • 0

I have a function which will resize the image background when the page is loaded,

$(document).ready(function(){
loadBackground();
});

and I want to ‘unload’ or ‘remove’ this loaded function when I click on a button so that I can load this function anew instead of loading it on top of the page,

$('.get-image').click(function(){
        $(window).unbind("resize",loadBackground);
        loadBackground();
 return false;
 });

but I can’t make it work! any ideas please?

thanks,
Lau

  • 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-16T21:12:10+00:00Added an answer on May 16, 2026 at 9:12 pm

    Based on your comments, I don’t think you need to unbind at all:

    You first want to load the background when the page is loaded, and then you want to load the background when a click happens.

    What happens to the background when the image is resized should be another separate function that is bound to $(window).resize()… so the whole thing will look like this:

    ( $(function() { ... }); means the same as $(document).ready(function() { ... }) it’s just faster to write:

    $(function() { 
          // Define load BG
        function loadBackground() {
            /// ...
        }
    
          // Define what happens to the BG image on resize
          // this doesn't have to change. It should refer
          // to the generic `background-image`
        $(window).resize(function() { 
            // ...
        });
    
          // load BG when page is ready:
        loadBackground();
    
          // load another BG if there's a click:
          // This will effectively cancel the previous load bg
        $('.get-image').click(function() { 
            loadBackground();
            return false;
        });    
    });
    
    // I'm assuming you're somehow changing which BG image is loaded
    // something like loadBackground(image)... and you could initially 
    // load a default image, and then, if there's a click, you could
    // determine what image should be based on what was clicked.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have issue where i want to create Dynamic function which will do some
I have function some_func_1 which will create an object of type some_type and will
I have a Function in CFC file, which will be called from .cfm file
All, I have the following array and function, which will create a multidimensional array
I have small function which will recolor pixels in a Bitmap from a given
I currently have a page in which users can drag content around, resize it,
I need a PHP page that will take an image and resize to how
I have the following simple preloading function which substitute an image src attribute with
hi i have function which is called by tinker listbox so i cannot return
Can I´m asking for advice. I have function which should return javascript object function

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.