$(function() { function tab(ul,li){ $(li).mouseover(function(){ $(ul).hide().eq($(this).index()).show(); $(li).removeclass("hover").eq($(this).index()).addclass("hover"); return false; }); } function show(li,p){ $(li).hover(function(){ $(this).find(p).fadein(300); },function(){ $(this).find(p).fadeout(300); }); } jquery.navlevel2 = function(level1,dl,dytime) { $(level1).mouseenter(function(){ varthis = $(this); delytime=settimeout(function(){ varthis.find(dl).slidedown(); },dytime); }); $(level1).mouseleave(function(){ cleartimeout(delytime); $(this).find(dl).hide(); }); }; $.navlevel2(".mli",".m_dl",50); $(".zp_div .zp_title").click(function(){ $(".zp_div").find(".zp_txt").slideup() $(".zp_div").eq($(this).parent().index()).find(".zp_txt").slidedown(); $(".zp_div").removeclass("hover").eq($(this).parent().index()).addclass("hover"); return false; }); var hei=$(window).height(); $(".apply").click(function(){ var name=$(this).attr("data-id"); $('#name').val(name); $(".zp_bg").fadein(500); $(".zp_pos").css({"margin-top":(hei-339)/2}); }); $(".tc_close,.can").click(function(){ $(".zp_bg").fadeout(100); }); }); function qh(div,ul,li){ var swidth = $(div).width(); //获取焦点图的宽度(显示面积) var len = $(li).length; //获取焦点图个数 var index = 0; var pictimer; //以下代码添加数字按钮和按钮后的半透明条,还有上一页、下一页两个按钮 var btn = "
"; for(var i=0; i < len; i++) { btn += ""; } btn += "
"; $(div).append(btn); //为小按钮添加鼠标滑入事件,以显示相应的内容 $(div).find(".btn span").mouseenter(function() { index = $(div).find(".btn span").index(this); showpics(index); }).eq(0).trigger("mouseenter"); //上一页按钮 $(div).find(".pre").click(function() { index -= 1; if(index == -1) {index = len - 1;} showpics(index); }); //下一页按钮 $(div).find(".next").click(function() { index += 1; if(index == len) {index = 0;} showpics(index); }); //本例为左右滚动,即所有li元素都是在同一排向左浮动,所以这里需要计算出外围ul元素的宽度 // $(ul).css("width",swidth * (len)); showpics(index); //鼠标滑上焦点图时停止自动播放,滑出时开始自动播放 $(div).hover(function() { clearinterval(pictimer); },function() { pictimer = setinterval(function() { showpics(index); index++; if(index == len) {index = 0;} },4000); //此4000代表自动播放的间隔,单位:毫秒 }).trigger("mouseleave"); //显示图片函数,根据接收的index值显示相应的内容 function showpics(index) { //普通切换 var nowleft = -index*swidth; //根据index值计算ul元素的left值 $(li).eq(index).animate({opacity: 1,"z-index": "1"},1500).siblings().animate({opacity: 0,"z-index": "0"},1500); $(div).find(".btn span").removeclass("on").eq(index).addclass("on"); //为当前的按钮切换到选中的效果 $(div).find(".btn span").stop(true,false).animate({"opacity":"1"},500).eq(index).stop(true,false).animate({"opacity":"1","background":"red"},500); //为当前的按钮切换到选中的效果 } } function openlinks(url){ if(url.length != 0){ window.open(url) } } function add_job(){ var name=$('#name').val(); var fj=$('#fj').val(); if(fj==''){ alert('文件仅支持 word / jpg 格式,大小不超过2m'); return false; } if(!name){ alert('请选择职位'); return false; } var url="add_job.php"; var da={}; da['name']=name; da['fj']=fj; $.ajax({ type: "post", url: url, data: da, beforesend: function(xmlhttprequest){ }, success: function(data, textstatus){ var dt=parsefloat(data); if(dt==1){ alert("提交成功"); location.reload(); }else{ alert("error"); } }, complete: function(xmlhttprequest, textstatus){ }, error: function(){ alert("更新失败"); }, cache : false }); }