1// wp_nav:å¯¼èª 2; 3(function($) { 4 $.fn.sudyNav = function() { 5 var defaults = { 6 vertical: { 7 active: '0', 8 col: '1' 9 }, // 主è忝å¦çºµå,active 0å¦ 1æ¯ col,主èååæ° 10 drop_v: 'down', // 设置åèååç´å¼¹åºæ¹åï¼å䏿åä¸,up or down 11 drop_w: 'right', 12 dir: "y", // 设置åèåæ ç®æåæ¹åï¼x 为横åï¼y为纵å 13 dWidth: '0', // 设置åèåä½ç½®æ¯å¦ä»¥é¡µé¢å®½åº¦åç §ï¼å¦å以主èå容å¨å®½åº¦(å½dir设置为xæ¶ææï¼å³å¯¹åè忍ªåææ) 14 opacity_main: '1', 15 opacity_sub: '1' 16 }; 17 return this.each(function() { 18 var option = {}; 19 eval('option = '+($(this).attr("data-nav-config")||{})+';'); 20 var o = $.extend(true, {}, defaults, option); 21 var c = $(this); 22 var cW = (o.dWidth == '0') ? c.width() : $(document.body).width(); 23 var l = c.find(".nav-item"); 24 var u = c.find("ul"); 25 var su = u.find("ul"); 26 var cl = c.children('.nav-item'); 27 var cu = c.children('.nav-item').children('ul'); 28 var isIE6 = !-[1, ] && !window.XMLHttpRequest; 29 if (o.vertical.active == '1') { 30 c.css({height: 'auto'}).children('.nav-item').css({display: "block", width: (100 / o.vertical.col) + '%', float: 'none'}).children('a').css({display: "block", width: "auto"}); 31 if (o.vertical.col !== '1') { 32 c.children(".nav-item").css({display: "inline-block", float: 'left'}); 33 } 34 if (o.drop_v == 'up') { 35 u.css({bottom: '0px'}); 36 } else { 37 u.css({top: '0px'}); 38 } 39 if (o.drop_w == 'left') { 40 u.css({right: "100%"}); 41 } else { 42 u.css({left: '100%'}); 43 } 44 } else { 45 if (o.drop_v == 'up') { 46 su.css({bottom: '0px'}); 47 } else { 48 su.css({top: '0px'}); 49 } 50 if (o.drop_w == 'left') { 51 su.css({right: "100%"}); 52 } else { 53 su.css({left: '100%'}); 54 } 55 } 56 function setOpacity(e, a, w, h) { 57 var mark = e.children('i'); 58 if(a!=='-1'&&a!==-1)mark.css({opacity: a}); 59 if (isIE6) { 60 mark.css({width: w + 'px', height: h + 'px'}); 61 } 62 } 63 $.each(cl, function() { 64 var clW = $(this).width(); 65 var clH = $(this).height(); 66 setOpacity($(this), o.opacity_main, clW, clH); 67 }); 68 $.each(u, function() { 69 var sl = $(this).children(".nav-item"), suW = 0, suH = 0, sW = 0, sH = 0; 70 $.each(sl, function() { 71 var slW = $(this).outerWidth(), slH = $(this).outerHeight(); 72 suW = suW < slW ? slW : suW; 73 suH += slH; 74 sW += slW; 75 sH = sH < slH ? slH : sH; 76 setOpacity($(this), o.opacity_sub, slW, slH); 77 }); 78 if (o.dir == 'x') { 79 var pX = $(this).parent('.nav-item').offset().left + sW; 80 var cX = (o.dWidth == '0') ? (c.offset().left + cW) : cW; 81 var dX = cX - pX; 82 var left = dX < 0 ? dX : 0; 83 $(this).css({width: sW + 'px', height: sH + 'px', left: left + 'px'}); 84 var pH = $(this).parent('.nav-item').outerHeight(); 85 if (o.drop_v == 'up') { 86 $(this).css({bottom: pH + 'px'}); 87 } else { 88 $(this).css({top: pH + 'px'}); 89 } 90 } else { 91 $(this).css({width: suW + 'px', height: suH + 'px'}); 92 sl.css({display: "block", width: "100%"}).children('a').css({display: "block", width: "auto"}); 93 setOpacity(sl, o.opacity_sub, suW, sH); 94 } 95 }); 96 if (o.dir !== 'x' && o.vertical.active !== '1') { 97 $.each(cu, function() { 98 var pH = $(this).parent('.nav-item').outerHeight(); 99 if (o.drop_v == 'up') { 100 $(this).css({bottom: pH + 'px'}); 101 } else { 102 $(this).css({top: pH + 'px'}); 103 } 104 if (o.drop_w == 'left') { 105 $(this).css({right: "0"}); 106 } else { 107 $(this).css({left: '0'}); 108 } 109 }); 110 } 111 l.hover(function() { 112 $(this).addClass("on").siblings().removeClass("on"); 113 $(this).children('a').addClass('parent'); 114 $(this).children("ul").css("visibility", "visible").end().siblings().find("ul").css("visibility", "hidden"); 115 }, function() { 116 $(this).removeClass("on"); 117 $(this).children('a').removeClass('parent'); 118 $(this).find("ul").css("visibility", "hidden"); 119 }); 120 }); 121 }; 122})(jQuery); 123 124$(function() { 125 $(".wp_nav").sudyNav(); 126});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.