$(function(){ // 先取得 div#abgne_marquee ul // 接著把 ul 中的 li 項目再重覆加入 ul 中(等於有兩組內容) // 再來取得 div#abgne_marquee 的高來決定每次跑馬燈移動的距離 // 設定跑馬燈移動的速度及輪播的速度 var $marqueeUl = $('div#abgne_marquee ul'), $marqueeli = $marqueeUl.append($marqueeUl.html()).children(), _height = $('div#abgne_marquee').height() * -1, scrollSpeed = 600, timer, speed = 3000 + scrollSpeed; // 幫左邊 $marqueeli 加上 hover 事件 // 當滑鼠移入時停止計時器;反之則啟動 $marqueeli.hover(function(){ clearTimeout(timer); }, function(){ timer = setTimeout(showad, speed); }); // 控制跑馬燈移動的處理函式 function showad(){ var _now = $marqueeUl.position().top / _height; _now = (_now + 1) % $marqueeli.length; // $marqueeUl 移動 $marqueeUl.animate({ top: _now * _height }, scrollSpeed, function(){ // 如果已經移動到第二組時...則馬上把 top 設 0 來回到第一組 // 藉此產生不間斷的輪播 if(_now == $marqueeli.length / 2){ $marqueeUl.css('top', 0); } }); // 再啟動計時器 timer = setTimeout(showad, speed); } // 啟動計時器 timer = setTimeout(showad, speed); $('a').focus(function(){ this.blur(); }); }); var tooltip=function(){ var id = 'tooltip'; var top = 0; var left = -20; var maxw = 300; var speed = 30; var timer = 20; var endalpha = 95; var alpha = 0; var tt,t,c,b,h; var ie = document.all ? true : false; return{ show:function(v,w){ if(tt == null){ tt = document.createElement('div'); tt.setAttribute('id',id); t = document.createElement('div'); t.setAttribute('id',id + 'top'); c = document.createElement('div'); c.setAttribute('id',id + 'cont'); b = document.createElement('div'); b.setAttribute('id',id + 'bot'); tt.appendChild(t); tt.appendChild(c); tt.appendChild(b); document.body.appendChild(tt); tt.style.opacity = 0; tt.style.filter = 'alpha(opacity=0)'; document.onmousemove = this.pos; } tt.style.display = 'block'; c.innerHTML = v; tt.style.width = w ? w + 'px' : 'auto'; if(!w && ie){ t.style.display = 'none'; b.style.display = 'none'; tt.style.width = tt.offsetWidth; t.style.display = 'block'; b.style.display = 'block'; } if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'} h = parseInt(tt.offsetHeight) + top; clearInterval(tt.timer); tt.timer = setInterval(function(){tooltip.fade(1)},timer); }, pos:function(e){ var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY; var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX; tt.style.top = (u - h) + 'px'; tt.style.left = (l + left) + 'px'; }, fade:function(d){ var a = alpha; if((a != endalpha && d == 1) || (a != 0 && d == -1)){ var i = speed; if(endalpha - a < speed && d == 1){ i = endalpha - a; }else if(alpha < speed && d == -1){ i = a; } alpha = a + (i * d); tt.style.opacity = alpha * .01; tt.style.filter = 'alpha(opacity=' + alpha + ')'; }else{ clearInterval(tt.timer); if(d == -1){tt.style.display = 'none'} } }, hide:function(){ clearInterval(tt.timer); tt.timer = setInterval(function(){tooltip.fade(-1)},timer); } }; }(); /* Author : Audi http://audi.tw Date:Sep 2008, v0.2 歡迎應用於無償用途散播,並請勿移除本版權宣告 */ var bVer=parseInt(navigator.appVersion); var bName=navigator.appName.toLowerCase(); var _agent=navigator.userAgent.toLowerCase(); _slideMenu_ie6 = (_agent.indexOf("msie 6.0") != -1); _slideMenu_ie7 = (_agent.indexOf("msie 7.0") != -1); _slideMenu_isIE = (_slideMenu_ie6 || _slideMenu_ie7); function slideMenu(id){ this.id=id; this.menu=document.getElementById(id); this.submenu=this.menu.getElementsByTagName("span"); this.speed=3; this.delay=30; this.onloadFuns=window.onload; } slideMenu.prototype.init=function(){ var pointer=this, a, c; for(var i=0; icHeight){ submenu.style.height=newHeight+'px'; }else { clearInterval(interval); submenu.style.height=cHeight+'px'; submenu.className='collapsed'; } }, delay); } slideMenu.prototype.collapseOther=function(submenu){ var smenu; for (var i=0;i< this.submenu.length;i++){ smenu=this.submenu[i].parentNode.getElementsByTagName('ul')[0]; if (typeof smenu!='undefined'){ if (smenu!=submenu && smenu.className=='expand'){ this.collapseMenu(smenu); } } } } function expandCurrentLink(){ var currentLink=(_slideMenu_isIE)?window.location.toString().toLowerCase():window.location.pathname.toString().toLowerCase(); var alink=document.getElementById(_slideMenu_ID).getElementsByTagName('a'); for (var i=0;i