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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:33:09+00:00 2026-06-05T05:33:09+00:00

My title might be a bit unclear. For example I have this code: $(‘#element’).image_resize_crop();

  • 0

My title might be a bit unclear. For example I have this code:

$('#element').image_resize_crop();

At a certain point the image_resize_crop plugin I’m writing is finished preloading an image. How do I return that to the script that called the function in the first place?

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-06-05T05:33:10+00:00Added an answer on June 5, 2026 at 5:33 am

    You can either trigger a custom event which they can subscribe to and execute code,

    $(elem).trigger('preloadComplete');
    

    and they can use it

    $('#element').on('preloadComplete',function(){
        // do what they want
    })
    

    or receive a oncomplete handler as setting of the plugin like this

    $('#element').image_resize_crop(function(){
    
    });
    

    Or as part of settings object

    $('#element').image_resize_crop({
         onComplete: function(){
    
         }
    });
    

    And if you want to pass some data to that callback you can instruct them so like this

    $('#element').image_resize_crop({
         onComplete: function(data){
           // utilize data passed from plugin
         }
    });
    

    And call that function when image preloading is complete.

    In your plugin code you can call it like

    settings.onComplete.call(this,arg1,arg2);
    

    Where this is what that onComplete function will get as this variable inside it, and arg1,arg2 are the values it will get as arguments.

    You can use apply method too.

    Read more here: call or apply

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

Sidebar

Related Questions

the title might be a little bit confusing, let me explain, ;) I have
The title of this question might be a bit off but its the closest
Title might be a bit confusing, so let me explain. I have a website
The original question: The title of this question might be a bit clumsily phrased,
I know the title of this question might be a little bit misleading; I
I asked a question , title of which might have been misleading so I'm
Here's the fiddle: http://jsfiddle.net/scZtb/1/ Be warned, as the title suggests, this might crash your
The title might be a bit misleading, but I couldn't figure out a better
The title might be a bit misleading, but I don't know how else to
the question title might be a bit confuse. but here is my case. i

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.