Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy getScript() is not working in my case
    primarykey
    data
    text
    <p>I am trying to load jQuery plugin based on the choice made as shown in the <a href="http://jsfiddle.net/99FtJ/1/" rel="nofollow">fiddle</a>.<br> JS</p> <pre><code>$(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 = '&lt;a href="' + src + '" class="cloud-zoom" rel="adjustX: 10, adjustY:-4" target="_blank"/&gt;'; th.wrap(''+str+''); break; case 2: str = '&lt;a href="' + src + '" class="cloud-zoom"'; str+= 'rel="'+"position:'inside', showTitle: false, adjustX:-4, adjustY:-4"+'" target="_blank"/&gt;'; th.wrap(''+str+''); break; } if( choice == 1 || choice == 2) { $("head").append("&lt;link&gt;"); 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(); }); } }); }); </code></pre> <p>HTML</p> <pre><code>&lt;img src="http://cdn.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/best-jquery/serie3.jpg" class="type4" alt="jghdhefyhe" height="100px" width="130px"&gt; </code></pre> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload