| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- $(function() {
- var box = $('.list-wrap');
- box.each(function(index) {
- //Todo => 高度大于108显示箭头
- if($(this).height() > 108){
- var flag = true;
- var target = $(this);
- var chil = target.height('108px').siblings('.jiantou');
- chil.fadeOut(function(){$(this).fadeIn().css('display','block')});
- chil.click(function(){
- if(flag){
- target.fadeOut(function(){
- $(this).height('100%').fadeIn();
- });
- $(this).html('收起')
- flag = false;
- }else{
- target.fadeOut(function(){
- $(this).height('108px').fadeIn();
- });
- flag = true;
- $(this).html('加载更多')
- }
- });
-
- }
- })
- var right_box = $('.right-box.jlr');
- var jlr_box = $('.right-box.jlr .jlr-box');
- var right_btn = $('.right-box.jlr .jlr-btn i');
- add(jlr_box,right_btn,0,3000);
- function add(ele,btn,count=0,special) {
- ele.parent().data('timer', setInterval(function(){
- count ++;
- if(count >= ele.length){
- count = 0;
- }
- box_loop(ele, count);
- btn_loop(btn, count);
- },special));
- }
- function box_loop(ele,count=0){
- ele.eq(count).addClass('active').siblings().removeClass('active');
- }
- function btn_loop(ele,count=0){
- ele.eq(count).addClass('active').siblings().removeClass('active');
- }
- $(right_btn).mouseover(function() {
- console.log(right_box.data('timer'));
- clearInterval(right_box.data('timer'));
- var target_index = $(this).index();
- jlr_box.eq(target_index).addClass('active').siblings().removeClass('active');
- right_btn.eq(target_index).addClass('active').siblings().removeClass('active');
- }).mouseout(function(event) {
- var target_index = $(this).index();
- add(jlr_box,right_btn,target_index,3000);
- });
- var slide = $('#slide-scroll');
- var slide_ul = $('#slide-scroll').find('ul');
-
- slided(slide_ul,0,100);
- $(slide_ul).mouseenter(function() {
- clearInterval($(this).data('timer'));
- }).mouseleave(function() {
- var target_num = parseInt($(this).css('marginTop'));
- slided(slide_ul,target_num,100);
- });
- function slided(ele,num=1,special) {
- ele.data('timer', setInterval(function(){
- num --;
- if(num === -36){
- num = 0;
- var $li = $(ele).find('li:lt(2)').remove();
- ele.append($li);
- }
- ele.css('marginTop',num);
- },special));
- }
- });
|