首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在执行jquery加载之前禁用链接

如何在执行jquery加载之前禁用链接
EN

Stack Overflow用户
提问于 2010-11-02 12:59:48
回答 1查看 333关注 0票数 1

我随身带着下面的Jquery。

代码语言:javascript
复制
 $(".load-fragment").each(function()         
        {          
            var $objThis = $(this);
            var fname = $objThis.attr("href"); //Getting the href of the element
            var dynDivID = "divContent"+ $objThis.attr("id");  //Name of the dynamic div ID
            var newDiv = $("<div>").attr("id",dynDivID)
            .load(fname+ " #tab-container", {pupdate:"true"},function(response, status, xhr) 
            {               
                //Checking whether response contains class "formContainer" in it or not                
                if( $(response).filter('#tab-container').find('.formContainer').length ) 
                {      
                    ($objThis).unbind("click"); //Removing the attached click event                                                  
                }      
                else
                {
                $("#container-4").append(newDiv);//adding new div in div column2
                }           
                if (status == "error") 
                {               
                    newDiv.removeClass('dynDiv');
                    newDiv.addClass('errorDiv');
                }

            })//Loading page fragment from the given link
            .hide()//Hiding all the newly created DIVs
            .addClass('dynDiv')//Adding CSS to newly created Dynamic Divs
            .append($('<img/>').attr({ src: '/system/Images/ajax-loader.gif', alt: '', style:'margin:50px 0px 50px 185px' }));//Adding the loading.gif file

        });  

现在,我想禁用所有其他链接,直到我的JQuery加载完成,一旦完成,所有其他链接就会像往常一样工作。

请给我建议!

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-11-02 13:02:20

如果我理解正确的话,那么最好的办法就是默认禁用所有链接,并在jquery ready函数中启用所有这些链接。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4075022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档