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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:44:12+00:00 2026-06-03T00:44:12+00:00

I’ve created some code which people can copy and paste into their websites, and

  • 0

I’ve created some code which people can copy and paste into their websites, and it should work in blogspot. This code requires jQuery and the jCarousel plugin. I use

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

to load jQuery before running my javascript code. The issue is that some blogger templates load jQuery already, and then running the above code causes the blog post to never load (it just stays on the loading screen).

I could load it using javascript after if (typeof jQuery == "undefined") but for the jCarousel plugin to work jQuery must be loaded first, so this causes the post to load but the carousel to break.

Anybody know any solutions?

  • 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-03T00:44:14+00:00Added an answer on June 3, 2026 at 12:44 am

    Can’t you check for the existence of jQuery and still load jCarousel after that?

    <script type="text/javascript">
        if (typeof jQuery === "undefined") {  
            document.write('<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"><\/script>');
        }
    </script>
    
    <script src="http://path/to/jcarousel" type="text/javascript"></script>
    

    On second thought, I am not convinced this will always work. I don’t think this guarantees that jQuery will load before jCarousel. I came up with an alternate solution that seems to be more robust. It makes sure that jQuery is loaded, and then uses jQuery to load the library using $.getScript(). Then your code is called from the callback of getScript. This ensures that everything happens in the proper order:

    <script type="text/javascript">
        if (typeof jQuery !== "undefined") {
            loadLibs();
        } else {
            var script = document.createElement('script');
            script.src = 'http://code.jquery.com/jquery.js';
            document.getElementsByTagName('head')[0].appendChild(script);
            var timeout = 100; // 100x100ms = 10 seconds
            var interval = setInterval(function() {
                timeout--;
                if (window.jQuery) {
                    clearInterval(interval);
                    loadLibs();
                } else if (timeout <= 0) {
                    // jQuery failed to load
                    clearInterval(interval);
                }
            }, 100);
        }
    
        function loadLibs() {
            $.getScript("http://sorgalla.com/projects/jcarousel/lib/jquery.jcarousel.min.js", function(data, textStatus, jqxhr) {
                myCode();
            });
        }
    
        function myCode() {
            $(document).ready(function() {
                $('#mycarousel').jcarousel();
            });
        }
    </script>
    

    Demo: http://jsfiddle.net/jtbowden/Y84hA/2/

    (Change the Framework in the left column to any version of jQuery, or some other library. It should always load the carousel correctly)

    Edit:

    This version is similar, but uses a <head> load for the lib, just like for jQuery. It is faster than $.getScript():

    http://jsfiddle.net/jtbowden/y8nGJ/1/

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.