/*** 导航 ***/ $(function(){ $('.m-shouchang a:last').css({'padding-right':'0'}); $('.f-nav .u-li:first').css({'width':'66px'}); $('.f-nav .u-li:first .u-a').css({'width':'60px','margin-left':'-30px'}); $('.f-nav .u-li:last').css({'width':'74px','background':'none'}); $('.f-nav .u-li:last .u-a').css({'width':'60px','margin-left':'-20px'}); $('.f-nav .u-li').each(function(index, element) { $(this).addclass('u-li'+index); var fnavnw=$(this).find('.f-unav li').length*$(this).find('.f-unav li:first').width(); $(this).find('.f-unav').css({'width':fnavnw}); if($(this).hasclass('current')){ $(this).find('.u-name').css({'background-position':' center 0'}); } $(this).hover(function(){ $(this).addclass('hover').siblings().removeclass('hover'); //当前主导航添加样式:current,其他的删除样式:current $(this).find('.u-line').fadein(200); if($(this).find('.f-unav li').length>0){ $('.nav-xbg').stop().show(); $(this).find('.f-unav').stop().show(); //当前子导航显示 } },function(){ $(this).removeclass('hover'); //当前主导航删除样式:current $(this).find('.u-line').fadeout(200); $(this).find('.f-unav').stop().hide(); //当前子导航隐藏 $('.nav-xbg').stop().hide(); }); }); $('.nav-xbg').hover(function(){ $('.nav-xbg').show(); },function(){ $('.nav-xbg').hide(); }); $('.f-subnav .u-li').each(function(index, element) { $(this).hover(function(){ $(this).addclass('hover').siblings().removeclass('hover'); //当前主导航添加样式:current,其他的删除样式:current if($(this).find('.f-unav li').length>0){ $(this).find('.f-unav').show(); //当前子导航显示 } },function(){ $(this).removeclass('hover'); //当前主导航删除样式:current $(this).find('.f-unav').stop(true,false).hide(); //当前子导航隐藏 }); }); }); /** banner **/ $(window).resize(function(){ pagesize(); }); function pagesize(){ if($('body').width() > 1000){ $('.m-focus .switchable-content li').css({'width':$('body').width()}); }else{ $('.m-focus .switchable-content li').css({'width':'1000px'}); } }; $(function(){ $('.m-focus .switchable-content li').each(function(index, element) { var imgsrc=$(this).find('img').attr('src'); $(this).css('background','url('+imgsrc+') no-repeat scroll 50% 0px transparent'); }); pagesize(); $('.m-focus').slide({ //direction: 'y', speed: 'slow', navcls: 'switchable-nav', contentcls: 'switchable-content', caption: true, //是否带有标题 //prevbtncls:'u-focus-prev', //nextbtncls:'u-focus-next', evtype: 'click', effect:'fade' //'random', 'normal', 'fade', 'scroll', 'fold', 'slice', 'slide', 'shutter', 'grow' }); }); //subban $(function(){ if($('.subfocus-box').length>0){ var subimg=$('.subfocus-box img').attr('src'); $('.subfocus-box').css({'background':'url('+subimg+') center top no-repeat'}); }; }); //标题 $(function(){ $('.main-title').each(function(index, element) { var emw=$(this).find('em').width()+5; $(this).find('h2').css({'padding-left':emw}); }); }); //加入收藏 function addfavorite(obj, url, title) { var e = window.event || arguments.callee.caller.arguments[0]; var b = { ie : /msie/.test(window.navigator.useragent) && !window.opera , ff : /firefox/.test(window.navigator.useragent) , op : !!window.opera }; obj.onmousedown = null; if (b.ie) { obj.attachevent("onmouseup", function () { try { window.external.addfavorite(url, title); window.event.returnvalue = false; } catch (exp) {} }); } else { if (b.ff || obj.nodename.tolowercase() == "a") { obj.setattribute("rel", "sidebar"), obj.title = title, obj.href = url; } else if (b.op) { var a = document.createelement("a"); a.rel = "sidebar", a.title = title, a.href = url; obj.parentnode.insertbefore(a, obj); a.appendchild(obj); a = null; } } } //设为首页 function sethome(obj,url){ try{ obj.style.behavior='url(#default#homepage)'; obj.sethomepage(url); }catch(e){ if(window.netscape){ try{ netscape.security.privilegemanager.enableprivilege("universalxpconnect"); }catch(e){ alert("抱歉,此操作被浏览器拒绝!\n\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'"); } }else{ alert("抱歉,您所使用的浏览器无法完成此操作。\n\n您需要手动将【"+url+"】设置为首页。"); } } }