日期:2014-05-16 浏览次数:20373 次
$.each($(".{$this->prefix}allElder"),function(index,value){ var elder = $(this).next().next('.{$this->prefix}elder'); var maxWidth = $this->maxWidth; var width = $this->width; var vertical = $(this).children(".{$this->prefix}vertical"); //算出平均长度 length = Math.ceil((maxWidth)/(vertical.length-1)-1); avage = Math.ceil($this->width/2);//竖线 $.each(vertical,function(index,value){ if( $(this).parent().next().next().children("div:eq("+index+")").html() == null) { side = $(this).parent().prev().prev().children("div:eq("+index+")"); } else { side = $(this).parent().next().next().children("div:eq("+index+")"); } if(index ==0 ) { //竖线第一个 $(this).addClass('{$this->prefix}left'); $(this).css({'left':avage+'px','overflow':'hidden','position':'absolute'}); $(side).css({'left':index*length,'overflow':'hidden','position':'absolute'}); } else if(index == (vertical.length-1)) { //竖线最后一个 $(this).addClass('{$this->prefix}right'); $(this).css({'right':avage+'px','overflow':'hidden','position':'absolute'}); $(side).css({'right':avage-25,'overflow':'hidden','position':'absolute'}); } else { $(this).addClass('{$this->prefix}left'); if(vertical.length%2 == 1 && (Math.ceil((vertical.length)/2)-1) == index) { $(this).css({'left':maxWidth/2-1,'overflow':'hidden','position':'absolute'}); $(side).css({'left':maxWidth/2-25,'overflow':'hidden','position':'absolute'}); } else { $(this).css({'left':index*length,'overflow':'hidden','position':'absolute'}); $(side).css({'left':index*length-25,'overflow':'hidden','position':'absolute'}); } } }) });