$(function(){ $(".postImg").each(function(){ var firstnewsimg = $(this).find(".list1").find("li:first-child").find("a").attr("href"); var $news2 = $(this).find(".list2").find(".news"); $(this).find(".list2").find(".news").each(function(index,el){ $(this).hide(); var thisimg = $news2.eq(index).find("a").attr("href"); if( firstnewsimg !== thisimg ){ // newsimgIndex++; $(this).show(); } }); }); $("#keyword").focus(function(event) { /* Act on the event */ var val = $.trim($(this).val()); if(val=="在此输入"){ $(this).val(""); } }).blur(function(event) { /* Act on the event */ var val = $.trim($(this).val()); if(val==""){ $(this).val("在此输入"); } }); $(".wp_search .search").click(function(event) { $(this).removeAttr("name"); /* Act on the event */ event.preventDefault(); var val = $.trim($("#keyword").val()); if(val!==""&& val!=="在此输入"){ window.location.href="/znss/list.htm?title="+val; //$("#searchform").submit(); }else{ alert("请输入关键词"); } }); var $menu = $(".menu"); $("li",$menu).hover(function() { /* Stuff to do when the mouse enters the element */ $(this).css("width","auto"); $(this).children('.sub-menu').stop(true,true).fadeIn(400).siblings().children('.sub-menu').fadeOut(10); }, function() { /* Stuff to do when the mouse leaves the element */ $(this).children('.sub-menu').fadeOut(10); }); $(".post-28").each(function(index, el) { $(el).hover(function() { $(this).addClass('wrap-open').find('.con').slideDown(300); }, function() { $(this).removeClass('wrap-open').find('.con').slideUp(100); }); }); var $gotop = $("#gotop"); $(".back-top",$gotop).click(function(event) { /* Act on the event */ event.preventDefault(); $("html,body").stop().animate({scrollTop:0}, 700); }); $(window).scroll(function(event) { var windHeight = $(window).height(); var scrolltop = $(window).scrollTop(); var height = $gotop.outerHeight(); var top = windHeight + scrolltop - 50 -height; if(scrolltop>260){ $gotop.stop().show().animate({top:top}, 300); }else{ $gotop.stop().hide(); } }); }); if($.trim($('.pda').text()) == '' || undefined){ $('.pda').parent().hide() }