漂亮的Catch404弹出模态窗口

下载地址

让我们来看看jQuery在引擎下!可以看到在下面的代码片段中,最先进的代码在这个插件执行超过404的部分处理。因为我们连接到第三方网站(雅虎)来访问这个URL,将有一两秒钟的等待在我们的查询,这是如此有效的URL以及那些不是。以确保用户知道什么回事可以有用的页面上显示一个进度叠加与标签的检查URL状态. .”或类似的东西。function performAjaxCall(url,msg,container) { if(url.match("^http")){ msg.html(" (checking...)"); //connect to yahoo YQL to get a response for the URL $.getJSON("http://query.yahooapis.com/v1/public/yql?"+ "q=select * from html where url=""+ encodeURIComponent(url)+ ""&format=xml"&callback=?", function(data){ if(data.results[0]){ var data = filterData(data.results[0]); //if the url passes the test, navigate to it donav(url); } else { msg.html(" (404!)"); //otherwise display the modal error window fourPop(); } } ); }现在我们定义我们的模态窗口函数如下:function fourPop(){ var popWidth = 500; //dim[0].split("=")[1]; var popID = "404message"; $("#" + popID).fadeIn().css({ "width": Number( popWidth ) }).prepend("Close"); var popMargTop = ($("#" + popID).height() + 80) / 2; var popMargLeft = ($("#" + popID).width() + 80) / 2; //Apply Margin to Popup $("#" + popID).css({ "margin-top" : -popMargTop, "margin-left" : -popMargLeft }); //Fade in Background $("body").append("

"); . $("#fade").css({"filter" : "alpha(opacity=80)"}).fadeIn(); return false; }; //Close Popups and Fade Layer $("a.close, #fade").live("click", function() { $("#fade , .popup_block").fadeOut(function() { $("#fade, a.close").remove(); }); return false; }); }); }HTMLThis is a link to checkJavaScript$(document).ready(function(){$(".ajaxcheck").catch404();});

263_007bdbdd30cb34ae9ba69e27eff45ac8.jpg

dd:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值