$(function(){ var numpic = $('#slides li').size()-1; var nownow = 0; var inout = 0; var TT = 0; var SPEED = 3000; $('#slides li').eq(0).siblings('li').css({'display':'none'}); var ulstart = ''; ADDLI(); var pagination = $('#pagination li'); var paginationwidth = $('#pagination').width(); $('#pagination').css('margin-left',(70-paginationwidth)) pagination.eq(0).addClass('current') function ADDLI(){ //var lilicount = numpic + 1; for(var i = 0; i <= numpic; i++){ ulcontent += '
  • ' + '' + (i+1) + '' + '
  • '; } $('#slides').after(ulstart + ulcontent + ulend); } pagination.on('click',DOTCHANGE) function DOTCHANGE(){ var changenow = $(this).index(); $('#slides li').eq(nownow).css('z-index','90'); $('#slides li').eq(changenow).css({'z-index':'80'}).show(); pagination.eq(changenow).addClass('current').siblings('li').removeClass('current'); $('#slides li').eq(nownow).fadeOut(400,function(){$('#slides li').eq(changenow).fadeIn(500);}); nownow = changenow; } pagination.mouseenter(function(){ inout = 1; }) pagination.mouseleave(function(){ inout = 0; }) function GOGO(){ var NN = nownow+1; if( inout == 1 ){ } else { if(nownow < numpic){ $('#slides li').eq(nownow).css('z-index','90'); $('#slides li').eq(NN).css({'z-index':'80'}).show(); pagination.eq(NN).addClass('current').siblings('li').removeClass('current'); $('#slides li').eq(nownow).fadeOut(400,function(){$('#slides li').eq(NN).fadeIn(500);}); nownow += 1; }else{ NN = 0; $('#slides li').eq(nownow).css('z-index','90'); $('#slides li').eq(NN).stop(true,true).css({'z-index':'80'}).show(); $('#slides li').eq(nownow).fadeOut(400,function(){$('#slides li').eq(0).fadeIn(500);}); pagination.eq(NN).addClass('current').siblings('li').removeClass('current'); nownow=0; } } TT = setTimeout(GOGO, SPEED); } TT = setTimeout(GOGO, SPEED); }) //下拉选框 $(function(){ $(".select").each(function(){ var s=$(this); var z=parseInt(s.css("z-index")); var dt=$(this).children("dt"); var dd=$(this).children("dd"); var _show=function(){dd.slideDown(200);dt.addClass("cur");s.css("z-index",z+1);}; //展开效果 var _hide=function(){dd.slideUp(200);dt.removeClass("cur");s.css("z-index",z);}; //关闭效果 dt.mouseover(function(){dd.is(":hidden")?_show():_hide();}); dd.find("a").mouseover(function(){dt.html($(this).html());_hide();}); //选择效果(如需要传值,可自定义参数,在此处返回对应的“value”值 ) $("body").mouseover(function(i){ !$(i.target).parents(".select").first().is(s) ? _hide():"";}); }) });