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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:02:49+00:00 2026-05-27T18:02:49+00:00

Why is it that this works: http://jsfiddle.net/w82W8/1/ But this doesn’t?: http://jsfiddle.net/w82W8/2/ This question may

  • 0

Why is it that this works: http://jsfiddle.net/w82W8/1/
But this doesn’t?: http://jsfiddle.net/w82W8/2/

This question may seem convoluted; you may wonder, why not just use the first!? Why are you using jQuery to load in JS+CSS assets that you could easily load in the original HTML.

Well, I’m in the process of building a web widget and I’d like to keep the embed code as small as possible. The idea is to have the user include a single <script type='text/javascript' src='http://mysite.com/widget.js'></script> line in their code, and the widget.js code will take care of all the details. Including fetching fancybox.

I’m getting the error: Uncaught TypeError: Object [object Object] has no method ‘fancybox’

I hypothesize that javascript is not waiting for fancybox.js to load, and immediately attempting to apply fancybox() to the trigger. Can I get a callback working here when the assets have been loaded? I’m certain they are getting included in the DOM though… I’ve inspected with Chrome Tools.

I know this question has been asked on StackOverflow before, but not in this context.

Thanks, and Happy Holidays!

  • 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-27T18:02:49+00:00Added an answer on May 27, 2026 at 6:02 pm

    At the second method, the fancybox method is called before the Fancybox plugin has loaded. Use the getScript method if you want to execute code after loading a script.

    Example:

    $.getScript(
        "http://jordanarsenault.com/fancy/fancybox.js",
        function(){
           $(".trigger").fancybox();
        }
    );
    

    If you need an advanced resource loader, consider using a real loader, such as yepnope.

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

Sidebar

Related Questions

I have this fiddle : http://jsfiddle.net/XjeCf/1/ that works like I want and this one
Here is the fiddle this one works http://jsfiddle.net/P72UR/ this one doesn't http://jsfiddle.net/j86TA/1/ Sorry I
I really like the way this works: http://jsfiddle.net/cTuQ4/ However, instead of 'Show 5 More'
I have code located here http://jsfiddle.net/jostster/5XAUb/ This works in Safari / FF (for the
This code works fine here http://jsfiddle.net/LH7sy/11/ It tries to find sml( and )sml in
This almost works http://jsfiddle.net/RfWsy/4/ $(document).ready(function() { function addRows(label, maxRows, minRows) { $('.add-' + label).live('click',
I just realized that this piece of code works well in Firefox but not
I've recently been using this set up on a website... http://jsfiddle.net/mnRNE/ CSS body {
I have this code : http://jsfiddle.net/Qchmqs/BSKrG/ <div class=step><-- this is darned wrong <div id=step2><a>Darn</a></div>
In this fiddle i have a part of my form: http://jsfiddle.net/ZXSKH/55/ I am trying

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.