jquery 插件--简单页面导航

(function($,W) {     
	$.fn.nav = function(options) {
	   $this = $(this);
	   var defaults = {
			editing:false,
			parent:false,
			beforeQuit:function(){
				
			}
	   };
	   defautls = $.extend(defaults,options);
	   var data;
	   if(defaults.parent){
		   data = parent.navs = [];
	   }else{
		   data = parent.navs = parent.navs || [];
	   }
	
	   var url = W.document.location.href;
	   var title = W.document.getElementsByTagName("title")[0].innerText;
	   
	   var node = new navNode(url,title);
	   
	   var index = -1;
	   for(var i=0;i"+ data[i].name +"";
		   }else{
			  html += ""+ data[i].name +"";
		   }
	   }
	   $this.append(html);
	   $this.css({"margin":"10px"});
	   $this.delegate("a", "click",data, function() {
		   var index = $(this).attr("dataIndex");
		   if(index != data.length -1){
			   if(defaults.editing){
				   $.omMessageBox.confirm({
						title : '确认离开',
						content : '您当前处于编辑状态,确认离开?',
						onClose : function(v) {
							if (v) {
								W.document.location.href = data[index].url;
							}
						}
					});
			   }else{
				   W.document.location.href = data[index].url;
			   }
		   }
	   });
	   
	};   
	function navNode(url,name){
		   this.url = url;
		   this.name = name;
	   }
	navNode.prototype.toString = function(){
		   return ""+ name +"";
	};
})(jQuery,window);   
$("#nav").nav({}); 

iframe 页面



适用情况

主页面包含