Error in Firefox + IE8 “ .draggable is not a function ”
I am getting the following error displayed in Firebug using Firefox 3.5.9, error also in IE8. Chrome works great, no problems at all.
- $("#dragMe_" + myCount).draggable is not a function
- $("#dragMe_"+myCount).draggable({ containment: 'parent', axis: 'y' }); Line 231
- http://www.liamharding.com/pgi/pgi.php
Link to page in question : http://www.liamharding.com/pgi/pgi.php
Once you click the above link, follow along: Click the 2 checkbox's '`R25 + R50 Random Walk`' then click `Show/Refresh Graphs`. Two graphs should be displayed, both with draggable thin horizontal red lines.
Re-open the options panel and de-select `R50 Random Walk`, now click `Show/Refresh Graphs` again, 1 graph is removed and the other updated; now re-select `R50 Random Walk` and click `Show/Refresh`, the `R25 graph` gets updated ok, then the above error occurs and i cant figure out why.
Initially, when displaying the first 2 graphs it uses the same code to create the 'draggable' divs and it works just fine.
Now, if I "remove" the use of 'jquery-ui' for my easing animation & draggable lines over the graphs the page works perfectly in Firefox+IE8, as in this url: " liamharding.com/pgi/pgi2.php "
So something to do with jquery-ui in this page ??? I'm not sure where to go from here.
The error occurs in this line (from the code below):
- //********* ERROR OCCURS HERE **********
- $("#dragMe_"+myCount).draggable({ containment: 'parent', axis: 'y' });
Here is the code for the `Show/Refresh Graphs.click() event`:
- $("#btnShowGraphs").click(function(){
- // Hide 'Options' panel (only if open AND an index is checked)
- if (IsOptionsPanelOpen && ($("#indexCheck:checked").length != 0)) {$('#optionImgDiv').click();};
-
- var myCount = 0;
- var divIsNew = false;
- var gif_loader_small = '<div id="gif_loader_small"></div>';
- var gif_loader_big = '<div id="gif_loader_big"></div>';
-
- $("input:checkbox[id=indexCheck]").each(function() {
-
- if (this.checked) {
- // check for an existing wrapper div for the current forex item, using the current checkbox value (foxex name)
- if ( $("#"+this.value).length == 0 ) {
-
- console.log("New 'graphContainer' div : "+this.value);
-
- divIsNew = true;
- // Create new divs for graph image, drag bar and heading
- var $structure = " \
- <li id=\""+this.value+"\" class=\"graphContainer\"> \
- <div id=\"dragMe_"+myCount+"\" class=\"dragMe\"></div> \
- <div id=\"image_"+myCount+"\" class=\"image\"></div> \
- <div id=\"heading_"+myCount+"\" class=\"heading\"></div> \
- </li> \
- ";
- $('#graphResults').append($structure);
- // Hide dragMe DIV
- $('#dragMe_'+myCount).hide();
- // Make 'dragMe' draggable div
-
- //********* ERROR OCCURS HERE **********
- $("#dragMe_"+myCount).draggable({ containment: 'parent', axis: 'y' });
- }
-
- // Display small loading gif
- $(gif_loader_small).clone().appendTo( $(this).parent() );
-
- // Display large circular loading gif
- var $loader = $(gif_loader_big);
- // add temporary css attributes onto existing graph divs as they need to be displayed diffrently
- if(!divIsNew){
-
- console.log("Reposition existing 'gif_loader_big' div");
-
- $loader = $(gif_loader_big).css({
- "position" : "absolute",
- "top" : "35%",
- "opacity" : ".85"});
- }
-
- // add newly styled big-loader-gif to index div
- $loader.clone().prependTo( $("#"+this.value) );
-
- // Call function to fetch image using ajax
- get_graph(this, myCount, divIsNew);
-
- } else {
- // REMOVE 'graphContainer' DIVS NOT CHECKED
- // check for div existance
- if ( $("#"+this.value).length != 0 ) {
-
- console.log("DESTROY: #dragMe_"+myCount+", REMOVE: #"+this.value);
-
- // DESTROY draggable
- //$("#dragMe_"+myCount).draggable("destroy");
- // remove div
- $("#"+this.value).remove();
- }
- }
- // reset counters and other variables
- myCount++;
- divIsNew = false;
-
- console.log("Complete: "+this.value+", NEXT index");
-
- });
- });
[1]: http://www.liamharding.com/pgi/pgi.php