/* * @Author: xy-xiaofei * @Date: 2016-01-28 13:43:54 * @Last Modified by: xy-xiaofei * @Last Modified time: 2016-04-27 15:41:30 */ $(function() { /*瀵艰埅涓嬫媺*/ $('.nav ul>.hide_nav').hover(function(event) { $(this).children('dl').stop().slideDown(200); $(this).children('.vv').addClass('ff'); },function(){ $(this).children('dl').stop().slideUp(200); $(this).children('.vv').removeClass('ff'); }); /*杞挱鍥?/ $('.flexslider').flexslider({ directionNav: false, pauseOnAction: false, slideshowSpeed: 4000, controlNav: true }); /*杞挱鍥惧乏鍙崇澶?/ $(".flexslider").hover(function() { $('.flex-direction-nav li a').css('display', 'block'); }, function() { $('.flex-direction-nav li a').css('display', 'none'); }); /*瑙嗛杞挱鍥?/ var num=$('.show_off li img').height(); var num_li = $('.show_off li').length; num_li -= 4; num+=29; /*var num1=$('.big-img li').width();*/ var speed=500; timer=null; num2=0; function autoPlay(){ num2++; if(num2>num_li){ num2=0; } $('.show_off').stop().animate({top:(-num2*num)}, speed); }; function backPlay(){ num2--; if (num2 < 0) { num2= num_li; } $('.show_off').stop().animate({top:(-num2*num)}, speed); }; //鑷姩鎾斁 /*timer=setInterval(autoPlay,2000);*/ // $('.show_off').hover(function() { // clearInterval(timer); // }, function() { // timer=setInterval(autoPlay,2000); // }); $('.w_r .s-next').click(function(event) { autoPlay(); }); $('.w_r .s-prev').click(function(event) { backPlay(); }); $('.w_r ul li').click(function(event) { //鐐瑰嚮缂╃暐鍥炬洿鎹㈠ぇ鍥 var as ; as = $(this).find('img').attr('rel'); var mm; mm = $(this).find('img').attr('res'); $('.video-current').removeClass(); $(this).addClass('video-current'); $('#videoa').html(''); //$('#big_pic').attr('src', as); }); }); var Speed = 10; //閫熷害(姣) var Space = 10; //姣忔绉诲姩(px) var PageWidth = 530; //缈婚〉瀹藉害 var fill = 0; //鏁翠綋绉讳綅 var MoveLock = false; var MoveTimeObj; var Comp = 0; var AutoPlayObj = null; GetObj("List2").innerHTML = GetObj("List1").innerHTML; GetObj('ISL_Cont').scrollLeft = fill; GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);} GetObj("ISL_Cont").onmouseout = function(){AutoPlay();} AutoPlay(); function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval ('document.all.'+objName)}} function AutoPlay(){ //鑷姩婊氬姩 clearInterval(AutoPlayObj); AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',2000); //闂撮殧鏃堕棿 } function ISL_GoUp(){ //涓婄炕寮€濮 if(MoveLock) return; clearInterval(AutoPlayObj); MoveLock = true; MoveTimeObj = setInterval('ISL_ScrUp();',Speed); } function ISL_StopUp(){ //涓婄炕鍋滄 clearInterval(MoveTimeObj); if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){ Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth); CompScr(); }else{ MoveLock = false; } AutoPlay(); } function ISL_ScrUp(){ //涓婄炕鍔ㄤ綔 if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj ('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth} GetObj('ISL_Cont').scrollLeft -= Space ; } function ISL_GoDown(){ //涓嬬炕 clearInterval(MoveTimeObj); if(MoveLock) return; clearInterval(AutoPlayObj); MoveLock = true; ISL_ScrDown(); MoveTimeObj = setInterval('ISL_ScrDown()',Speed); } function ISL_StopDown(){ //涓嬬炕鍋滄 clearInterval(MoveTimeObj); if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){ Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill; CompScr(); }else{ MoveLock = false; } AutoPlay(); } function ISL_ScrDown(){ //涓嬬炕鍔ㄤ綔 if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;} GetObj('ISL_Cont').scrollLeft += Space ; } function CompScr(){ var num; if(Comp == 0){MoveLock = false;return;} if(Comp < 0){ //涓婄炕 if(Comp < -Space){ Comp += Space; num = Space; }else{ num = -Comp; Comp = 0; } GetObj('ISL_Cont').scrollLeft -= num; setTimeout('CompScr()',Speed); }else{ //涓嬬炕 if(Comp > Space){ Comp -= Space; num = Space; }else{ num = Comp; Comp = 0; } GetObj('ISL_Cont').scrollLeft += num; setTimeout('CompScr()',Speed); } }