$(function(){ //首页导航 $(".nav li").mouseover(function(){ var obj = $(this); var active = obj.attr("class"); if (!active) { obj.addClass("active"); } else obj.attr("rel","true"); }).mouseout(function(){ var obj = $(this); var active = obj.attr("class"); var rel = obj.attr("rel"); if (active && !rel) { obj.removeClass("active"); } }); //首页过往期刊tab $(".t_box li a").hover(function(){ var obj = $(this).parent("li"); $(".t_box li").removeClass("active"); obj.addClass("active"); var i = $(".t_box li").index(obj); $(".list_box").hide(); $(".list_box").eq(i).show(); return false; }) //首页期刊杂志scroll $(".catalog").imageScroller({ next: ".mag_new a.rightbtn", prev: ".mag_new a.leftbtn", frame: ".catalog > ul", child: ".catalog li.subcata", auto: true, t:6000 }); $(".sel_year").bind("mouseenter", function (event) { $(".sel_con").show(); $(".sel_year span").addClass("up"); }).bind("mouseleave", function (event) { $(".sel_con").hide(); $(".sel_year span").removeClass("up"); }); }); //收藏期刊 function add_magfavorite(mid,pid) { var url = "mag!favorite.action?mid="+mid+"&pid="+pid; $.ajax({ type:"GET", url:url, success:function(data){ if (data == "suc") alert("收藏成功"); else if (data == "fail") alert("你已收藏"); else if (data == "login") { alert("请登录后,再收藏本期刊"); $("#j_username").focus(); } } }); } function getComments(tid) { var data = "tid="+tid; $.ajax({ type : "POST", data : data, url : "mag!loadComment.action", dataType:"json", success : function(msg) { var count = msg.totalCount; if (count == -1) count = 0; $("#commentNum").html(count); $("#comments").html(""); if (msg.result != null) { var obj = msg.result; for(var i=0; i

"+obj[i].content+"

"; $("#comments").append(str); } } } }) } function lastComments() { $.ajax({ type : "POST", url : "mag!lastComment.action", dataType:"json", success : function(obj) { for(var i=0; i"+obj[i].title+""; $("#lastcomment").append(str); } } }) }