Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui jqueryui";。可拖动不是一个函数";,错误_Jquery Ui_Draggable - Fatal编程技术网

Jquery ui jqueryui";。可拖动不是一个函数";,错误

Jquery ui jqueryui";。可拖动不是一个函数";,错误,jquery-ui,draggable,Jquery Ui,Draggable,我收到以下错误(使用Firefox 3.5.9): 链接到相关页面: 单击上面的链接后,请按照以下步骤操作:单击2个复选框的“R25+R50随机游走”,然后单击显示/刷新图形。应显示两个图形,均带有可拖动的细水平红线 重新打开选项面板并取消选择R50随机游走,现在再次单击显示/刷新图形,删除一个图形,更新另一个图形;现在重新选择R50随机游走并单击Show/Refresh,R25图形更新正常,然后出现上述错误,我无法找出原因 最初,当显示前两个图形时,它使用相同的代码,并且工作正常 错误发生在这

我收到以下错误(使用Firefox 3.5.9):

链接到相关页面:

单击上面的链接后,请按照以下步骤操作:单击2个复选框的“
R25+R50随机游走”
,然后单击
显示/刷新图形
。应显示两个图形,均带有可拖动的细水平红线

重新打开选项面板并取消选择
R50随机游走
,现在再次单击
显示/刷新图形
,删除一个图形,更新另一个图形;现在重新选择
R50随机游走
并单击
Show/Refresh
,R25图形更新正常,然后出现上述错误,我无法找出原因

最初,当显示前两个图形时,它使用相同的代码,并且工作正常

错误发生在这一行:

//********* ERROR OCCURS HERE **********
$("#dragMe_"+myCount).draggable({ containment: 'parent', axis: 'y' });
以下是显示/刷新图形的代码。单击()事件:

$("#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");

        });
    });
$(“#btnShowGraphs”)。单击(函数(){
//隐藏“选项”面板(仅当打开并选中索引时)
如果(IsOptionsPanelOpen&($(“#索引检查:选中”).length!=0)){$('#optionImgDiv')。单击();};
var-myCount=0;
var=new=false;
变量gif_loader_small='';
变量gif_loader_big='';
$(“输入:复选框[id=indexCheck]”)。每个(函数(){
如果(选中此项){
//使用当前复选框值(foxex name)检查当前外汇项目的现有包装div
if($(“#”+此.value).length==0){
log(“新的‘graphContainer’div:+this.value”);
除数new=true;
//为图形图像、拖动栏和标题创建新div
var$structure=”\
  • \ \ \ \
  • \ "; $('#graphResults')。追加($structure); //隐藏拖网分区 $('#dragMe'+myCount).hide(); //使“dragMe”可拖动div //*********这里发生错误********** $(“#dragMe_”+myCount).draggable({containment:'parent',axis:'y'}); } //显示小加载gif $(gif_loader_small).clone().appendTo($(this.parent()); //显示大循环加载gif var$loader=$(gif\u loader\u big); //将临时css属性添加到现有的graph div中,因为它们需要以不同的方式显示 如果(!新){ log(“重新定位现有的'gif_loader_big'div”); $loader=$(gif\u loader\u big).css({ “位置”:“绝对”, “顶部”:“35%”, “不透明度”:“.85”}); } //将新样式的大加载器gif添加到索引div $loader.clone().prependTo($(“#”+this.value)); //调用函数以使用ajax获取图像 获取图(this、myCount、divisionnew); }否则{ //删除未选中的“graphContainer”DIVS //检查div是否存在 if($(“#”+此.value).length!=0){ log(“销毁:#dragMe"+myCount+”,删除:#“+this.value); //销毁可拖动的 //$(“dragMe”+myCount).可拖动(“销毁”); //删除div $(“#”+this.value).remove(); } } //重置计数器和其他变量 myCount++; 除数new=false; log(“完成:“+this.value+”,下一个索引”); }); });
    注意,该脚本在Chrome中工作,但在Firefox中不工作,因为它使用了“console”对象,没有为没有该功能的浏览器提供支持。此外,我在Chrome 5中没有发现问题。@Geoff,谢谢你的回答,是的,它在Chrome中工作得很好。你能详细解释一下你所说的“……但不是Firefox,因为它使用了‘console’对象,而没有为没有该功能的浏览器提供支持。”,你是说我在上面的脚本中使用了‘console.log’吗?如果是这样,我添加了它们来调试问题。是的,控制台对象存在于Google Chrome中,但它不是Firefox的一部分。这会导致脚本在我单击“显示/刷新图形”按钮时停止执行,因此整个过程在Firefox中根本无法工作:)为了将来的调试,解决这个问题的方法是创建一个名为“console”的模拟对象,其中包含一个名为“log”的函数,它根本不需要做任何事情。这意味着它在其他浏览器上测试时不会停止执行,也意味着您不必每次在其他浏览器中测试时都删除或恢复调试控制台.log行。@Geoff,在此url中“”我已删除所有“console.log”调用,问题仍然存在!!现在,如果我不再使用“jquery ui”来简化动画和图形上的可拖动线条,那么该页面在Firefox中就可以完美地工作,如下面的url:”。那么这个页面中的jquery ui有什么关系???我不知道从这里到哪里去!铬合金的一切都很好。。。。。
    $("#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");
    
            });
        });