Posted in Javascript onJuly 02, 2010
/* <a href="a.html" onclick="return $.qbox(this);" > <a href="a.html" onclick="return qBox.iFLoad(this);" > <a href="a.html" onclick="return qBox.iFrame({src:'b.html'})" > Boxy属性不变 新增 w、h、src 属性 qBox.Close();关闭当前窗口 qBox.iFSrc({}); 改变当前窗口的属性及指向 Boxy属性不变 新增 w、h、src 属性 */ //Boxy插件的扩展 jQuery.fn.qbox=function(options){ var node = this.get(0).nodeName.toLowerCase(); var self=this; if (node == 'a') { $(this).attr('onclick','').unbind('click').click(function(){return false;}); options = $.extend(options||{},{src:this.get(0).getAttribute('href'),beforeUnload:function(){ $(self).unbind('click').click(function(){return $(this).qbox(options);});}}); } qBox.iFLoad(options); return false; } var qBox=function(){}; jQuery.extend(qBox,{ aDgs:[], iFrame:function(op){ op = jQuery.extend({title:'提示',w:320,h:200,src:'about:blank',modal:false,fixed:false,unloadOnHide:true},op),fm=parseInt(Math.random()*(1000*987));// var dialog = new Boxy("<b id=\"ld"+fm+"\">正在加载,请稍后....</b><iframe id=\"_"+fm+"\" style=\"width:0;height:0;display:none;padding:0;\" src="+op.src+" frameborder=\"0\" scrolling=\"no\"></iframe>",op); jQuery("#_"+fm).load(function(){ dialog.resize(op.w,op.h,function(){}); jQuery("#ld"+fm).remove(); jQuery("#_"+fm).css({'padding':'15px','display':''}); }); qBox.aDgs.push(dialog); return false; }, Close:function(){ qBox.aDgs[qBox.aDgs.length-1].hide(); return false }, iFSrc:function(op){ op = jQuery.extend({w:320,h:200,src:'about:blank'},op); qBox.aDgs[qBox.aDgs.length-1].getContent().attr("src","about:blank"); qBox.aDgs[qBox.aDgs.length-1].setTitle(op.t); qBox.aDgs[qBox.aDgs.length-1].tween(op.w,op.h,function(){qBox.aDgs[qBox.aDgs.length-1].getContent().attr("src",op.src).css({width:op.w,height:op.h});}); return false; }, iFLoad:function(options){ var sr= jQuery(this).attr("href"); var op = jQuery.extend({src:sr},options); qBox.iFrame(op); return false; } });
出处 cn795.cnblogs.com
jquery.boxy插件的iframe扩展代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@