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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:23:47+00:00 2026-05-26T16:23:47+00:00

I am trying to load jQuery plugin based on the choice made as shown

  • 0

I am trying to load jQuery plugin based on the choice made as shown in the fiddle.
JS

$(document).ready(function()
{
 $('img').each(function()
    {
        var th=$(this);
        var className=th.prop('class');
        var clas=['type1','type2','type3','type4','type5','type6','type7','type8','type9','type10'];
        var choice=((jQuery.inArray(className,clas))*1) + 1;
        var str="";
        var src=th.attr('src');
        var titleText=th.attr('alt');
        switch(choice)
        {
            case 1:
                    alert('fall under Type1')
                    str = '<a href="' + src + '" class="cloud-zoom" rel="adjustX: 10, adjustY:-4" target="_blank"/>';
                    th.wrap(''+str+'');
                    break;
            case 2:
                    str = '<a href="' + src + '" class="cloud-zoom"'; 
                    str+= 'rel="'+"position:'inside', showTitle: false, adjustX:-4, adjustY:-4"+'" target="_blank"/>';
                    th.wrap(''+str+'');
                    break;
        }
        if( choice == 1 || choice == 2)
        {
            $("head").append("<link>");
            css = $("head").children(":last");
            css.attr({
             rel:  "stylesheet",
             type: "text/css",
             href: "http://www.professorcloud.com/styles/cloud-zoom.css"
            });
       // In the js file method is invoking on domReady, That is why i am calling manually again on call back after wrapping HTML
            $.getScript("http://www.professorcloud.com/js/cloud-zoom.1.0.2.js", function(){
                $('.cloud-zoom').CloudZoom();
            });
        }
});
});

HTML

<img src="http://cdn.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/best-jquery/serie3.jpg" class="type4" alt="jghdhefyhe" height="100px" width="130px">

In the fiddle method invocation is written under domReady. That might be causing the problem, because I am wrapping custom HTML to make that plugin work. Please have a look at the above fiddle.

  • 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-26T16:23:48+00:00Added an answer on May 26, 2026 at 4:23 pm

    I think that that problem is that you are trying to load a script from a server on a different domain. You should use $.ajax() and set the option crossDomain to true.

    $.ajax({
      url: 'your url',
      dataType: "script",
      crossDomain: true,
      success: function()
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load fragments of XHTML markup using jQuery's $.fn.load function, but it
I'm trying to do write a jQuery plugin based on a prototype pattern. My
I'm trying to load in the jQuery template plugin using jQuery.getScript, but even though
I am trying to use the SimpleModal plugin for jquery to load a popup
I am trying to dynamically load a jQuery plugin by calling getScript - but
I'm trying to load a json events feed into the FullCalendar jQuery plugin, however,
I am trying to load mschart in my aspx page(SalesOverview.aspx) using jQuery.load() method, I
I'm running jquery from a file. And I'm trying to load a svg file
Ok I have this problem I'm trying to use Jquery to load a partial
I'm trying to attach a jQuery plugin to a dynamically generated button. I've tried

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.